Skip to content

Remove dead xUnit test-runner scaffolding after MSTest/MTP migration - #55093

Merged
Evangelink merged 2 commits into
mainfrom
dev/amauryleve/improved-carnival
Jul 1, 2026
Merged

Evangelink merged 2 commits into
mainfrom
dev/amauryleve/improved-carnival

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

Now that every SDK test project runs on MSTest.Sdk / Microsoft.Testing.Platform, this PR removes the leftover xUnit test-runner scaffolding that no longer has any consumer. It is pure dead-code / dead-configuration removal — no behavior change.

Changes

  1. Re-point the last legacy-framework consumer — Microsoft.TemplateEngine.Cli.UnitTests now references Microsoft.NET.TestFramework.MSTest instead of the xUnit-coupled Microsoft.NET.TestFramework. It was the only remaining test project referencing the legacy framework as a test dependency, so no test project references the legacy framework anymore.

  2. Prune dead xUnit plumbing from test/Directory.Build.*:

    • Directory.Build.targets: removed the IsTestProject==true AND UsingMSTestSdk != true branch (TestRunnerName=XUnitV3, OutputType=Exe/NoDefaultExcludes) and the global using Xunit. That condition now matches zero projects; the NetAnalyzers tests the stale comment referenced are MSTest.Sdk. Refreshed the surrounding comments.
    • Directory.Build.props: removed the now-unused XUnitDesktopSettingsFile / XUnitCoreSettingsFile properties.
    • Deleted test/xunit.runner.json (only reachable via those properties through eng/XUnitV3/XUnitV3.targets).
  3. Remove the orphaned eng/XUnitV3/ folder (XUnitV3.targets, XUnitV3.Runner.targets, xunit.runner.json). Arcade's Tests.targets imports eng/$(TestRunnerName)/$(TestRunnerName).targets only when a project sets TestRunnerName=XUnitV3 — set exclusively by the branch removed in (2). Nothing sets it (or UseXUnitAotPackages) anymore, and nothing references the folder by path.

Verification

Built with the repo toolset — all 0 warnings / 0 errors:

  • Microsoft.TemplateEngine.Cli.UnitTests (the re-point)
  • Microsoft.CodeAnalysis.NetAnalyzers.UnitTests (the one project that explicitly imports test/Directory.Build.targets)
  • Microsoft.NET.TestFramework (legacy framework, no regression)
  • dotnet-aot.Tests (MSTest.Sdk — confirms Arcade skips the test-runner import cleanly after eng/XUnitV3/ removal)

Follow-up (intentionally not in this PR)

The live Helix work-item infrastructure (test/xunit-runner/, SDKCustomXUnitProject in test/UnitTests.proj, the HelixTasks SDKCustomCreateXUnitWorkItems… task) is now runner-agnostic but still carries XUnit naming. Renaming it touches a compiled MSBuild task and is validated only by a full Helix run, so it's tracked as a separate follow-up rather than mixed into this dead-code removal.

Evangelink and others added 2 commits July 1, 2026 11:51
…nner plumbing

All SDK test projects now run on MSTest.Sdk/MTP. This removes the remaining xUnit test-runner scaffolding that no longer has any consumer:

- Re-point Microsoft.TemplateEngine.Cli.UnitTests from the legacy xUnit-coupled
  Microsoft.NET.TestFramework to its MSTest counterpart
  Microsoft.NET.TestFramework.MSTest. It was the last test project still
  referencing the legacy framework as a test dependency.
- Remove the dead non-MSTest branches from test/Directory.Build.targets
  (TestRunnerName=XUnitV3, OutputType=Exe/NoDefaultExcludes, and the global
  'using Xunit'). No non-MSTest test project remains to consume them; the
  NetAnalyzers tests that the stale comment referenced are now MSTest.Sdk.
- Remove the now-unused XUnitDesktopSettingsFile/XUnitCoreSettingsFile
  properties from test/Directory.Build.props and delete test/xunit.runner.json
  (only referenced by those properties via eng/XUnitV3/XUnitV3.targets, which is
  selected by TestRunnerName=XUnitV3 and so no longer imported).

Verified by building Microsoft.TemplateEngine.Cli.UnitTests, the NetAnalyzers
UnitTests (which explicitly import test/Directory.Build.targets), and the legacy
Microsoft.NET.TestFramework: all succeed with 0 warnings/0 errors.

Co-authored-by: Copilot <[email protected]>
Arcade's Tests.targets imports $(RepositoryEngineeringDir)$(TestRunnerName)/$(TestRunnerName).targets
only when a test project sets TestRunnerName=XUnitV3. That was set exclusively by the non-MSTest
branch in test/Directory.Build.targets, which was removed once every SDK test project moved to
MSTest.Sdk/MTP. No project sets TestRunnerName=XUnitV3 (or UseXUnitAotPackages) anymore, and nothing
references eng/XUnitV3 by path, so XUnitV3.targets / XUnitV3.Runner.targets / xunit.runner.json are dead.

Verified by building an MSTest.Sdk test project (dotnet-aot.Tests): Arcade skips the test-runner
import (TestRunnerName is empty for UsingToolXUnit=false projects) and the build succeeds with
0 warnings / 0 errors.

Co-authored-by: Copilot <[email protected]>

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

This PR removes now-unused xUnit v3 test-runner scaffolding/configuration from the repo after the migration of SDK test projects to MSTest.Sdk / Microsoft.Testing.Platform, and repoints the last remaining test project that still referenced the legacy xUnit-coupled test framework.

Changes:

  • Replaced Microsoft.TemplateEngine.Cli.UnitTests’ reference to Microsoft.NET.TestFramework with Microsoft.NET.TestFramework.MSTest.
  • Removed dead xUnit-specific properties/usings/runner selection logic from test/Directory.Build.* and deleted test/xunit.runner.json.
  • Deleted the orphaned eng/XUnitV3/ test-runner targets and associated runner config.
Show a summary per file
File Description
test/xunit.runner.json Deletes unused xUnit runner configuration no longer referenced by test builds.
test/Microsoft.TemplateEngine.Cli.UnitTests/Microsoft.TemplateEngine.Cli.UnitTests.csproj Switches test framework reference to the MSTest-specific framework project.
test/Directory.Build.targets Removes dead xUnit runner selection and global Xunit using; keeps MSTest/AwesomeAssertions behavior.
test/Directory.Build.props Removes now-unused xUnit runner settings file properties.
eng/XUnitV3/XUnitV3.targets Deletes unused xUnit v3 runner/import target file.
eng/XUnitV3/XUnitV3.Runner.targets Deletes unused xUnit runner execution target.
eng/XUnitV3/xunit.runner.json Deletes unused xUnit runner config under eng/.

Copilot's findings

  • Files reviewed: 7/7 changed files
  • Comments generated: 0

@Evangelink
Evangelink enabled auto-merge July 1, 2026 10:21
@Evangelink
Evangelink merged commit 704609c into main Jul 1, 2026
27 checks passed
@Evangelink
Evangelink deleted the dev/amauryleve/improved-carnival branch July 1, 2026 11:32
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants