Skills platform-detection
Reference data for detecting the test platform (VSTest vs Microsoft.Testing.Platform) and test framework (MSTest, xUnit, NUnit, TUnit) from project files. DO NOT USE directly — loaded by run-tests, mtp-hot-reload, and migrate-vstest-to-mtp when they need detection logic.
git clone https://github.com/dotnet/skills
T=$(mktemp -d) && git clone --depth=1 https://github.com/dotnet/skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/plugins/dotnet-test/skills/platform-detection" ~/.claude/skills/dotnet-skills-platform-detection && rm -rf "$T"
plugins/dotnet-test/skills/platform-detection/SKILL.mdTest Platform and Framework Detection
Determine which test platform (VSTest or Microsoft.Testing.Platform) and which test framework (MSTest, xUnit, NUnit, TUnit) a project uses.
Detection files to always check (in order):
global.json → .csproj → Directory.Build.props → Directory.Packages.props
Detecting the test framework
Read the
.csproj file and Directory.Build.props / Directory.Packages.props (for centrally managed dependencies) and look for:
| Package or SDK reference | Framework |
|---|---|
(metapackage, recommended) or | MSTest |
+ | MSTest (also valid for v3/v4) |
, , , , , | xUnit |
+ | NUnit |
| TUnit (MTP only) |
Detecting the test platform
The detection logic depends on the .NET SDK version. Run
dotnet --version to determine it.
.NET SDK 10+
On .NET 10+, the
global.json test.runner setting is the authoritative source:
- If
containsglobal.json
→ MTP"test": { "runner": "Microsoft.Testing.Platform" } - If
hasglobal.json
, or no"runner": "VSTest"
section exists → VSTesttest
Important: On .NET 10+,
alone does not switch to MTP. The<TestingPlatformDotnetTestSupport>runner setting takes precedence. If the runner is VSTest (or unset), the project uses VSTest regardless ofglobal.json.TestingPlatformDotnetTestSupport
.NET SDK 8 or 9
On older SDKs, check these signals in priority order:
1. Check the
MSBuild property. Look in the <TestingPlatformDotnetTestSupport>
.csproj, Directory.Build.props, and Directory.Packages.props. If set to true in any of these files, the project uses MTP.
Critical: Always read
andDirectory.Build.propsif they exist. MTP properties are frequently set there instead of in theDirectory.Packages.props, so checking only the project file will miss them..csproj
2. Check project-level signals:
| Signal | Platform |
|---|---|
as project SDK | MTP by default |
| MTP runner (xUnit) |
| MTP runner (MSTest) |
| MTP runner (NUnit) |
package referenced directly | MTP |
package referenced | MTP (TUnit is MTP-only) |
Note: The presence of
does not necessarily mean VSTest. Some frameworks (e.g., MSTest) pull it in transitively for compatibility, even when MTP is enabled. Do not use this package as a signal on its own — always check the MTP signals above first. Key distinction: VSTest is the classic platform that usesMicrosoft.NET.Test.Sdkunder the hood. Microsoft.Testing.Platform (MTP) is the newer, faster platform. Both can be invoked viavstest.console, but their filter syntax and CLI options differ.dotnet test