Migrates .NET test projects from VSTest to Microsoft.Testing.Platform (MTP). Use when user asks to "migrate to MTP", "switch from VSTest", "enable Microsoft.Testing.Platform", "use MTP runner", or mentions EnableMSTestRunner, EnableNUnitRunner, or UseMicrosoftTestingPlatformRunner. USE FOR: MTP behavioral differences vs VSTest (exit code 8, zero tests discovered), --ignore-exit-code, TESTINGPLATFORM_EXITCODE_IGNORE. Supports MSTest, NUnit, xUnit.net v2 (via YTest.MTP.XUnit2), and xUnit.net v3 (native MTP). Covers runner enablement, CLI argument translation, xUnit.net v3 filter migration (--filter-class, --filter-trait, --filter-query), Directory.Build.props and global.json configuration, CI/CD pipeline updates, and MTP extension packages. DO NOT USE FOR: migrating between test frameworks (MSTest/xUnit/NUnit), xUnit.net v2 to v3 API migration, MSTest version upgrades (use migrate-mstest-* skills), TFM upgrades, or UWP/WinUI test projects.
Automate repetitive workflows and reduce manual effort
Example: Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Learn new skills, understand complex topics, get expert guidance
Example: Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Enhance output quality through reviews, suggestions, and refinements
Example: Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
Time estimate: 15-45 minutes depending on use case complexity
Prerequisites
Submit your Claude Code skill and start earning
epx add dotnet/skills --skill migrate-vstest-to-mtpCompatible with
Supported agents
| name | migrate-vstest-to-mtp |
| description | > Migrates .NET test projects from VSTest to Microsoft.Testing.Platform (MTP). Use when user asks to "migrate to MTP", "switch from VSTest", "enable Microsoft.Testing.Platform", "use MTP runner", or mentions EnableMSTestRunner, EnableNUnitRunner, or UseMicrosoftTestingPlatformRunner. USE FOR: MTP behavioral differences vs VSTest (exit code 8, zero tests discovered), --ignore-exit-code, TESTINGPLATFORM_EXITCODE_IGNORE. Supports MSTest, NUnit, xUnit.net v2 (via YTest.MTP.XUnit2), and xUnit.net v3 (native MTP). Covers runner enablement, CLI argument translation, xUnit.net v3 filter migration (--filter-class, --filter-trait, --filter-query), Directory.Build.props and global.json configuration, CI/CD pipeline updates, and MTP extension packages. DO NOT USE FOR: migrating between test frameworks (MSTest/xUnit/NUnit), xUnit.net v2 to v3 API migration, MSTest version upgrades (use migrate-mstest-* skills), TFM upgrades, or UWP/WinUI test projects. |
| license | MIT |
Migrate a .NET test solution from VSTest to Microsoft.Testing.Platform (MTP). The outcome is a solution where all test projects run on MTP, dotnet test works correctly, and CI/CD pipelines are updated.
Important: Do not mix VSTest-based and MTP-based .NET test projects in the same solution or run configuration -- this is an unsupported scenario.
dotnet run / dotnet watch / direct executable execution for test projectsvstest.console.exe with dotnet test on MTPdotnet test arguments from VSTest syntax to MTP syntaxmigrate-mstest-v1v2-to-v3 or migrate-mstest-v3-to-v4| Input | Required | Description |
|---|---|---|
| Project or solution path | Yes | The .csproj, .sln, or .slnx entry point containing test projects |
| Test framework | No | MSTest, NUnit, xUnit.net v2, or xUnit.net v3. Auto-detected from package references |
| .NET SDK version | No | Determines dotnet test integration mode. Auto-detected via dotnet --version |
| CI/CD pipeline files | No | Paths to pipeline definitions that invoke vstest.console or dotnet test |
platform-detection skill for the package-to-framework mapping. Key indicators:
MSTest or MSTest.TestAdapter, or uses MSTest.Sdk (with <IsTestApplication> not set to false). Note: MSTest.TestFramework alone is a library dependency, not a test project.NUnit3TestAdapterxunit and xunit.runner.visualstudiodotnet --version) -- this determines how dotnet test integrates with MTPDirectory.Build.props file exists at the solution or repo root -- all MTP properties should go there for consistencyvstest.console.exe usage in CI scripts or pipeline definitionsdotnet test arguments in CI scripts: --filter, --logger, --collect, --settings, --blame*dotnet test to establish a baseline of test pass/fail countsCritical: Set MTP runner properties in
Directory.Build.propsat the solution or repo root whenever possible, rather than per-project. This prevents inconsistent configuration where some projects use VSTest and others use MTP (an unsupported scenario). Note: MTP also requires test projects to have<OutputType>Exe</OutputType>. OnlyMSTest.Sdksets this automatically. For all other setups (MSTest NuGet packages withEnableMSTestRunner, NUnit withEnableNUnitRunner, xUnit.net withYTest.MTP.XUnit2), prefer setting<OutputType>Exe</OutputType>centrally inDirectory.Build.propswith a condition that targets only test projects. If you cannot reliably target only test projects fromDirectory.Build.props, setting<OutputType>Exe</OutputType>per-project is an acceptable exception.Conditioning in
Directory.Build.props: Do NOT useCondition="'$(IsTestProject)' == 'true'"--IsTestProjectis set by the test SDK targets later in evaluation and is not available whenDirectory.Build.propsis imported. Use a property that is available early, such asMSBuildProjectName, to target test projects by naming convention. For example, if all test projects end in.Tests:<PropertyGroup Condition="$(MSBuildProjectName.EndsWith('.Tests'))"> <OutputType>Exe</OutputType> </PropertyGroup>Adjust the condition (e.g.,
.EndsWith('Tests'),.Contains('.Test')) to match the test project naming convention used in the repository.
Each framework has its own opt-in property. Add these in Directory.Build.props for consistency.
Option A -- MSTest NuGet packages (3.2.0+):
<PropertyGroup>
<EnableMSTestRunner>true</EnableMSTestRunner>
<OutputType>Exe</OutputType>
</PropertyGroup>
Ensure the project references MSTest 3.2.0 or later. If the version is already 3.2.0+, no MSTest version upgrade is needed for MTP migration.
Option B -- MSTest.Sdk:
When using MSTest.Sdk, MTP is enabled by default -- no EnableMSTestRunner or OutputType Exe property is needed (the SDK sets both automatically). The only action is: if the project has <UseVSTest>true</UseVSTest>, remove it. That property forces the project to use VSTest instead of MTP.
Requires NUnit3TestAdapter 5.0.0 or later.
NUnit3TestAdapter to 5.0.0+:<PackageReference Include="NUnit3TestAdapter" Version="5.0.0" />
<PropertyGroup>
<EnableNUnitRunner>true</EnableNUnitRunner>
<OutputType>Exe</OutputType>
</PropertyGroup>
Add a reference to YTest.MTP.XUnit2 -- this package provides MTP support for xUnit.net v2 projects without requiring an upgrade to xunit.v3. You must also set OutputType to Exe:
<PackageReference Include="YTest.MTP.XUnit2" Version="0.4.0" />
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>
Note:
YTest.MTP.XUnit2preserves the VSTest--filtersyntax, so no filter migration is needed for xUnit.net v2. It also supports--settingsfor runsettings (xunit-specific configurations only),xunit.runner.json, TRX reporting via--report-trx, and--treenode-filter.
xUnit.net v3 (xunit.v3 package) has built-in MTP support. Enable it with:
<PropertyGroup>
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
</PropertyGroup>
Important: xUnit.net v3 on MTP does NOT support the VSTest
--filtersyntax. You must translate filters to xUnit.net v3's native filter options (see Step 5).
The dotnet test integration depends on the .NET SDK version.
Use the native MTP mode by adding a test section to global.json:
{
"sdk": {
"version": "10.0.100"
},
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
In this mode, dotnet test arguments are passed directly -- for example, dotnet test --report-trx.
Important:
global.jsondoes not support trailing commas. Ensure the JSON is strictly valid.
Use the VSTest mode of dotnet test command to run MTP test projects by adding this property in Directory.Build.props:
<PropertyGroup>
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
</PropertyGroup>
Important: In this mode, you must use
--to separatedotnet testbuild arguments from MTP arguments. For example:dotnet test --no-build -- --list-tests.
VSTest-specific arguments must be translated to MTP equivalents. Build-related arguments (-c, -f, --no-build, --nologo, -v, etc.) are unchanged.
| VSTest argument | MTP equivalent | Notes |
|---|---|---|
--test-adapter-path | Not applicable | MTP does not use external adapter discovery |
--blame | Not applicable | |
--blame-crash | --crashdump | Requires Microsoft.Testing.Extensions.CrashDump NuGet package |
--blame-crash-dump-type <TYPE> | --crashdump-type <TYPE> | Requires CrashDump extension |
--blame-hang | --hangdump | Requires Microsoft.Testing.Extensions.HangDump NuGet package |
--blame-hang-dump-type <TYPE> | --hangdump-type <TYPE> | Requires HangDump extension |
--blame-hang-timeout <TIMESPAN> | --hangdump-timeout <TIMESPAN> | Requires HangDump extension |
--collect "Code Coverage;Format=cobertura" | --coverage --coverage-output-format cobertura | Per-extension arguments |
-d|--diag <LOG_FILE> | --diagnostic | |
--filter <EXPRESSION> | --filter <EXPRESSION> | Same syntax for MSTest, NUnit, and xUnit.net v2 (with YTest.MTP.XUnit2). For xUnit.net v3, see filter migration below |
-l|--logger trx | --report-trx | Requires Microsoft.Testing.Extensions.TrxReport NuGet package |
--results-directory <DIR> | --results-directory <DIR> | Same |
-s|--settings <FILE> | --settings <FILE> | MSTest and NUnit still support .runsettings |
-t|--list-tests | --list-tests | Same |
-- <RunSettings args> | --test-parameter | Applicable only to MSTest and NUnit |
MSTest, NUnit, and xUnit.net v2 (with YTest.MTP.XUnit2): The VSTest --filter syntax is identical on both VSTest and MTP. No changes needed.
xUnit.net v3 (native MTP): xUnit.net v3 does NOT support the VSTest --filter syntax on MTP. You must translate filters to xUnit.net v3's native filter options.
| Flag | Description |
|---|---|
--filter-class "name" | Run all tests in a given class. Supports wildcards (*). |
--filter-not-class "name" | Exclude all tests in a given class |
--filter-method "name" | Run a specific test method |
--filter-not-method "name" | Exclude a specific test method |
--filter-namespace "name" | Run all tests in a namespace |
--filter-not-namespace "name" | Exclude all tests in a namespace |
--filter-trait "name=value" | Run tests with a matching trait |
--filter-not-trait "name=value" | Exclude tests with a matching trait |
Multiple values can be specified with a single flag: --filter-class Foo Bar.
VSTest --filter syntax | xUnit.net v3 MTP equivalent | Notes |
|---|---|---|
FullyQualifiedName~ClassName | --filter-class *ClassName* | Wildcards required for substring match |
FullyQualifiedName=Ns.Class.Method | --filter-method Ns.Class.Method | Exact match on fully qualified method |
Name=MethodName | --filter-method *MethodName* | Wildcards for substring match |
Category=Value (trait) | --filter-trait "Category=Value" | Filter by trait name/value pair |
| Complex expressions | --filter-query "expr" | Uses xUnit.net query filter language (see below) |
For complex expressions, use --filter-query with a path-segment syntax:
/<assemblyFilter>/<namespaceFilter>/<classFilter>/<methodFilter>[traitName=traitValue]
Each segment matches against: assembly name, namespace, class name, method name. Use * for "match all" in any segment. Documentation: https://xunit.net/docs/query-filter-language
# VSTest
dotnet test --filter "FullyQualifiedName~IntegrationTests&Category=Smoke"
# xUnit.net v3 MTP -- using individual filters (AND behavior)
dotnet test -- --filter-class *IntegrationTests* --filter-trait "Category=Smoke"
# xUnit.net v3 MTP -- using query language (assembly/namespace/class/method[trait])
dotnet test -- --filter-query "/*/*/*IntegrationTests*/*[Category=Smoke]"
Note: When combining
--filter-classand--filter-trait, both conditions must match (AND behavior). For complex expressions, use--filter-querywith the path-segment syntax. See the xUnit.net query filter language docs for full reference.
If CI scripts use TRX reporting, crash dumps, or hang dumps, add the corresponding NuGet packages:
<!-- TRX report generation (replaces --logger trx) -->
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="1.6.2" />
<!-- Crash dump collection (replaces --blame-crash) -->
<PackageReference Include="Microsoft.Testing.Extensions.CrashDump" Version="1.6.2" />
<!-- Hang dump collection (replaces --blame-hang) -->
<PackageReference Include="Microsoft.Testing.Extensions.HangDump" Version="1.6.2" />
<!-- Code coverage (replaces --collect "Code Coverage") -->
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.13.0" />
If using the VSTest task (VSTest@3): Replace with the .NET Core CLI task (DotNetCoreCLI@2):
# Before (VSTest task)
- task: VSTest@3
inputs:
testAssemblyVer2: '**/*Tests.dll'
runSettingsFile: 'test.runsettings'
# After (.NET Core CLI task)
- task: DotNetCoreCLI@2
displayName: Run tests
inputs:
command: 'test'
arguments: '--no-build --configuration Release'
If already using DotNetCoreCLI@2: Update arguments per Step 5 translations. Remember the -- separator on .NET 9 and earlier:
- task: DotNetCoreCLI@2
displayName: Run tests
inputs:
command: 'test'
arguments: '--no-build -- --report-trx --results-directory $(Agent.TempDirectory)'
Update dotnet test invocations in workflow files with the same argument translations from Step 5.
If any script invokes vstest.console.exe directly, replace it with dotnet test. The test projects are now executables and can also be run directly.
VSTest silently succeeds when zero tests are discovered. MTP fails with exit code 8. Options:
--ignore-exit-code 8 when running testsDirectory.Build.props:<PropertyGroup>
<TestingPlatformCommandLineArguments>$(TestingPlatformCommandLineArguments) --ignore-exit-code 8</TestingPlatformCommandLineArguments>
</PropertyGroup>
TESTINGPLATFORM_EXITCODE_IGNORE=8Once migration is complete and verified, remove packages that are only needed for VSTest:
Microsoft.NET.Test.Sdk -- not needed for MTP (MSTest.Sdk v4 already omits it by default)xunit.runner.visualstudio -- only needed for VSTest discovery of xUnit.net (not needed when using YTest.MTP.XUnit2)NUnit3TestAdapter VSTest-only features -- the adapter is still needed but only for the MTP runnerNote: If you need to maintain VSTest compatibility during a transition period, keep these packages.
dotnet build -- confirm zero errorsdotnet test -- confirm all tests pass./bin/Debug/net8.0/MyTests.exe) -- confirm it worksdotnet build completes with zero errorsdotnet test passes all tests and test counts match pre-migration baseline./bin/Debug/net8.0/MyTests.exe)vstest.console.exe invocations remain in CI scripts<OutputType>Exe</OutputType> is set for all non-MSTest.Sdk test projects| Pitfall | Solution |
|---|---|
| Mixing VSTest and MTP projects in the same solution | Migrate all test projects together -- mixed mode is unsupported |
dotnet test arguments ignored on .NET 9 and earlier | Use -- to separate build args from MTP args: dotnet test -- --report-trx |
| Exit code 8 on CI without failures | MTP fails when zero tests run; use --ignore-exit-code 8 or fix test discovery |
| MSTest.Sdk v4 + vstest.console no longer works | MSTest.Sdk v4 no longer adds Microsoft.NET.Test.Sdk -- add it explicitly or switch to dotnet test |
Missing <OutputType>Exe</OutputType> | Required for all setups except MSTest.Sdk (which sets it automatically) |
Using Condition="'$(IsTestProject)' == 'true'" in Directory.Build.props | IsTestProject is not yet defined when Directory.Build.props is evaluated -- use $(MSBuildProjectName.EndsWith('.Tests')) (or a similar name-based check) instead |
run-tests for running tests on the new MTP platformmtp-hot-reload for iterative test fixing with hot reload on MTPAI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versionmigrate-vstest-to-mtpExecute the skills CLI command in your project's root directory to begin installation:
epx add dotnet/skills --skill migrate-vstest-to-mtpFetches migrate-vstest-to-mtp from dotnet/skills and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
.cursor/skills/migrate-vstest-to-mtp
Restart Cursor to activate migrate-vstest-to-mtp. Access via /migrate-vstest-to-mtp in your agent's command palette.
Learn more:View source on GitHubSkills CLI docsAbout CursorWhat are agent skills?
Steps
Common Pitfalls
✓ Do
✗ Don't
💡 Pro Tips
✓ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
test-tagging
dotnet/skills · dotnet-test · same repo
migrate-mstest-v1v2-to-v3
dotnet/skills · dotnet-test · same repo
analyzing-dotnet-performance
dotnet/skills · Productivity · same repo
dotnet-webapi
dotnet/skills · dotnet-aspnet · same repo
maui-dependency-injection
dotnet/skills · dotnet-maui · same repo
mcp-csharp-debug
dotnet/skills · dotnet-ai · same repo
I recommend migrate-vstest-to-mtp for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
migrate-vstest-to-mtp reduced setup friction for our internal harness; good balance of opinion and flexibility.
migrate-vstest-to-mtp is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
Useful defaults in migrate-vstest-to-mtp — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
migrate-vstest-to-mtp has been reliable in day-to-day use. Documentation quality is above average for community skills.
Useful defaults in migrate-vstest-to-mtp — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
migrate-vstest-to-mtp is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
migrate-vstest-to-mtp reduced setup friction for our internal harness; good balance of opinion and flexibility.
Solid pick for teams standardizing on skills: migrate-vstest-to-mtp is focused, and the summary matches what you get after install.
We added migrate-vstest-to-mtp from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
showing 1-10 of 27