[release/11.0.1xx-preview7] Support Microsoft.Build.Traversal projects in dotnet test (MTP)#55411
Merged
Evangelink merged 1 commit intoJul 22, 2026
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 2 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Evangelink
enabled auto-merge
July 22, 2026 15:21
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Microsoft.Build.Traversal (dirs.proj) support to dotnet test when using Microsoft.Testing.Platform (MTP), by expanding traversal graphs into referenced projects (including nested/diamond graphs), ensuring referenced test projects are built, and validating behavior with new integration assets/tests.
Changes:
- Teach MTP
dotnet testproject evaluation to detect traversal projects and recursively expandProjectReferenceitems with cross-graph de-duplication and per-referenceConfiguration/Platformforwarding. - Treat any
*projextension as a positional project argument so.projinputs aren’t forwarded to the test host as invalid arguments. - Update
_MTPBuildto forward the build to traversal@(ProjectReference)items and add direct + nested/diamond traversal integration coverage.
Show a summary per file
| File | Description |
|---|---|
| test/TestAssets/TestProjects/TraversalTestProjects/dirs.proj | New traversal asset (direct) listing referenced MTP test projects. |
| test/TestAssets/TestProjects/TraversalTestProjects/global.json | Selects MTP runner for the traversal asset. |
| test/TestAssets/TestProjects/TraversalTestProjects/TestProject/TestProject.csproj | New MTP test app project referenced by traversal. |
| test/TestAssets/TestProjects/TraversalTestProjects/TestProject/Program.cs | Dummy MTP adapter app entry point. |
| test/TestAssets/TestProjects/TraversalTestProjects/OtherTestProject/OtherTestProject.csproj | Second new MTP test app project referenced by traversal. |
| test/TestAssets/TestProjects/TraversalTestProjects/OtherTestProject/Program.cs | Dummy MTP adapter app entry point. |
| test/TestAssets/TestProjects/TraversalTestProjectsNested/dirs.proj | New traversal asset (nested/diamond) for recursion + de-dup testing. |
| test/TestAssets/TestProjects/TraversalTestProjectsNested/sub/dirs.proj | Nested traversal project forming the diamond graph. |
| test/TestAssets/TestProjects/TraversalTestProjectsNested/global.json | Selects MTP runner for the nested traversal asset. |
| test/TestAssets/TestProjects/TraversalTestProjectsNested/SharedTestProject/SharedTestProject.csproj | Shared MTP test app referenced by multiple traversal nodes. |
| test/TestAssets/TestProjects/TraversalTestProjectsNested/SharedTestProject/Program.cs | Writes marker files to deterministically assert de-dup behavior. |
| test/TestAssets/TestProjects/TraversalTestProjectsNested/LeafTestProject/LeafTestProject.csproj | Leaf MTP test app reachable only via nested traversal. |
| test/TestAssets/TestProjects/TraversalTestProjectsNested/LeafTestProject/Program.cs | Writes marker files to deterministically assert recursion behavior. |
| test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTests.cs | Adds direct + nested/diamond traversal integration tests. |
| src/Cli/dotnet/Commands/Test/CliConstants.cs | Adds constants for traversal detection and ProjectReference item access. |
| src/Cli/dotnet/Commands/Test/MTP/MSBuildUtility.cs | Recognizes any *proj positional project argument (including .proj). |
| src/Cli/dotnet/Commands/Test/MTP/SolutionAndProjectUtility.cs | Adds traversal-project expansion logic with de-dup + config/platform forwarding. |
| src/Layout/redist/MSBuildImports/Current/Microsoft.Common.targets/ImportAfter/Microsoft.TestPlatform.ImportAfter.targets | Forwards _MTPBuild through traversal project references and forwards per-reference config/platform. |
Copilot's findings
- Files reviewed: 18/18 changed files
- Comments generated: 3
Comment on lines
+1
to
+2
| <Project Sdk="Microsoft.Build.Traversal/4.1.82"> | ||
| <ItemGroup> |
Comment on lines
+1
to
+2
| <Project Sdk="Microsoft.Build.Traversal/4.1.82"> | ||
| <ItemGroup> |
Comment on lines
+1
to
+2
| <Project Sdk="Microsoft.Build.Traversal/4.1.82"> | ||
| <ItemGroup> |
YuliiaKovalova
approved these changes
Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #55297 to
release/11.0.1xx-preview7.Summary
dotnet testwith Microsoft.Testing.PlatformValidation
build.cmd -c Debugdotnet.Testsincremental build