Skip to content

[release/11.0.1xx-preview7] Support Microsoft.Build.Traversal projects in dotnet test (MTP)#55411

Merged
Evangelink merged 1 commit into
release/11.0.1xx-preview7from
dev/amauryleve/backport-traversal-mtp-preview7
Jul 22, 2026
Merged

[release/11.0.1xx-preview7] Support Microsoft.Build.Traversal projects in dotnet test (MTP)#55411
Evangelink merged 1 commit into
release/11.0.1xx-preview7from
dev/amauryleve/backport-traversal-mtp-preview7

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Backport of #55297 to release/11.0.1xx-preview7.

Summary

  • support Microsoft.Build.Traversal projects in dotnet test with Microsoft.Testing.Platform
  • expand nested traversal graphs while de-duplicating diamond references
  • forward per-reference Configuration and Platform metadata during build and evaluation
  • add direct and nested traversal integration coverage

Validation

  • build.cmd -c Debug
  • dotnet.Tests incremental build
  • traversal MTP tests: 4 passed (Debug and Release for both direct and nested/diamond scenarios)

Copilot AI review requested due to automatic review settings July 22, 2026 15:16
@Evangelink
Evangelink requested a review from a team as a code owner July 22, 2026 15:16
@azure-pipelines

Copy link
Copy Markdown
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 test project evaluation to detect traversal projects and recursively expand ProjectReference items with cross-graph de-duplication and per-reference Configuration/Platform forwarding.
  • Treat any *proj extension as a positional project argument so .proj inputs aren’t forwarded to the test host as invalid arguments.
  • Update _MTPBuild to 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>
@Evangelink
Evangelink merged commit 654b461 into release/11.0.1xx-preview7 Jul 22, 2026
29 checks passed
@Evangelink
Evangelink deleted the dev/amauryleve/backport-traversal-mtp-preview7 branch July 22, 2026 17:56
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants