Loading...
Loading...
Compare original and translation side by side
global.json.csprojDirectory.Build.propsDirectory.Packages.propsglobal.json.csprojDirectory.Build.propsDirectory.Packages.props.csprojDirectory.Build.propsDirectory.Packages.props| Package or SDK reference | Framework |
|---|---|
| MSTest |
| MSTest (also valid for v3/v4) |
| xUnit |
| NUnit |
| TUnit (MTP only) |
.csprojDirectory.Build.propsDirectory.Packages.props| 包或SDK引用 | 框架 |
|---|---|
| MSTest |
| MSTest(v3/v4版本同样适用) |
| xUnit |
| NUnit |
| TUnit(仅支持MTP) |
dotnet --versiondotnet --versionglobal.jsontest.runnerglobal.json"test": { "runner": "Microsoft.Testing.Platform" }global.json"runner": "VSTest"testImportant: 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
global.jsontest.runnerglobal.json"test": { "runner": "Microsoft.Testing.Platform" }global.json"runner": "VSTest"test重要提示:在 .NET 10+ 版本中,仅靠配置不会切换到 MTP。<TestingPlatformDotnetTestSupport>中的运行器配置优先级最高。如果运行器配置为 VSTest(或未设置),无论global.json配置如何,项目都会使用 VSTest。TestingPlatformDotnetTestSupport
<TestingPlatformDotnetTestSupport>.csprojDirectory.Build.propsDirectory.Packages.propstrueCritical: Always readandDirectory.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
| Signal | Platform |
|---|---|
| MTP by default |
| MTP runner (xUnit) |
| MTP runner (MSTest) |
| MTP runner (NUnit) |
| MTP |
| MTP (TUnit is MTP-only) |
Note: The presence ofdoes 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.Microsoft.NET.Test.Sdk
Key distinction: VSTest is the classic platform that usesunder 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
<TestingPlatformDotnetTestSupport>.csprojDirectory.Build.propsDirectory.Packages.propstrue关键提示:如果存在和Directory.Build.props请务必读取。MTP 属性经常被设置在这两个文件而非Directory.Packages.props中,因此仅检查项目文件会漏掉相关配置。.csproj
| 信号 | 平台 |
|---|---|
项目SDK为 | 默认使用 MTP |
| MTP 运行器(xUnit) |
| MTP 运行器(MSTest) |
| MTP 运行器(NUnit) |
直接引用 | MTP |
引用 | MTP(TUnit仅支持MTP) |
注意:存在并不一定代表使用 VSTest。部分框架(如 MSTest)为了兼容性会传递引入该包,哪怕已启用 MTP。请勿单独将该包作为判断依据 —— 始终优先检查上述MTP相关信号。Microsoft.NET.Test.Sdk
核心区别:VSTest 是底层使用的传统平台。Microsoft.Testing.Platform (MTP) 是更新、更快的平台。两者都可以通过vstest.console调用,但它们的过滤语法和CLI选项有所不同。dotnet test