Token导航 LogoToken导航

Agent Skill · 研究检索

migrate-vstest-to-mtp(将 vstest 迁移到 mtp)

用于辅助测试设计、自动化测试、用例整理和回归验证。它适合让 Agent 编写单元测试、端到端测试、测试计划或根据失败日志定位问题。使用时需要确认项目测试框架、运行命令和夹具数据,避免为了通过测试而改坏真实逻辑;涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。

migrate-vstest-to-mtp 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 23,460。

总安装 4,260周安装 174GitHub Stars 1,496下载 1,378核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:migrate-vstest-to-mtp(将 vstest 迁移到 mtp)
来源仓库:https://github.com/dotnet/skills
仓库路径:skills/migrate-vstest-to-mtp
安装命令:
npx skills add https://github.com/dotnet/skills --skill migrate-vstest-to-mtp
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/dotnet/skills --skill migrate-vstest-to-mtp

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

migrate-vstest-to-mtp 用于辅助测试设计、自动化测试、用例整理和回归验证。适合让 Agent 编写单元测试、端到端测试、测试计划或根据失败日志定位问题。使用时需确认项目测试框架、运行命令和夹具数据,避免误改真实逻辑。涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。

适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/migrate-vstest-to-mtp

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/dotnet/skills --skill migrate-vstest-to-mtp;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

migrate-vstest-to-mtp 怎么安装?

在终端执行 npx skills add https://github.com/dotnet/skills --skill migrate-vstest-to-mtp。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

migrate-vstest-to-mtp 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

migrate-vstest-to-mtp 需要什么权限?

权限级别是执行命令。安装流程涉及命令执行,可能通过 npx skills add https://github.com/dotnet/skills --skill migrate-vstest-to-mtp 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

migrate-vstest-to-mtp 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

migrate-vstest-to-mtp 用的人多吗?

公开数据是累计安装 4,260 次,近一周安装 174 次,下载 1,378 次,GitHub 1,496 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

migrate-vstest-to-mtp 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。
  • 来源仓库有 1,496 星,维护活跃度相对可查。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
migrate-vstest-to-mtp

将 vstest 迁移到 mtp · 本页

4,2601,496执行命令未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

VSTest -> Microsoft.Testing.Platform Migration

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.

When to Use

  • Switching from VSTest to Microsoft.Testing.Platform for any supported test framework
  • Enabling dotnet run / dotnet watch / direct executable execution for test projects
  • Enabling Native AOT or trimmed test execution
  • Replacing vstest.console.exe with dotnet test on MTP
  • Updating CI/CD pipelines from the VSTest task to the.NET Core CLI task
  • Updating dotnet test arguments from VSTest syntax to MTP syntax

When Not to Use

  • The project already runs on Microsoft.Testing.Platform -- migration is done
  • Migrating between test frameworks (e.g., MSTest to xUnit.net) -- different effort entirely
  • The project builds UWP or packaged WinUI test projects -- MTP does not support these yet
  • The solution mixes.NET and non-.NET test adapters (e.g., JavaScript or C++ adapters) -- VSTest is required
  • Upgrading MSTest versions -- use migrate-mstest-v1v2-to-v3 or migrate-mstest-v3-to-v4

Inputs

InputRequiredDescription
Project or solution pathYesThe .csproj, .sln, or .slnx entry point containing test projects
Test frameworkNoMSTest, NUnit, xUnit.net v2, or xUnit.net v3. Auto-detected from package references
.NET SDK versionNoDetermines dotnet test integration mode. Auto-detected via dotnet --version
CI/CD pipeline filesNoPaths to pipeline definitions that invoke vstest.console or dotnet test

Workflow

Step 1: Assess the solution

  1. Identify the test framework for each test project -- see the platform-detection skill for the package-to-framework mapping. Key indicators:

- MSTest: References 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. - NUnit: References NUnit3TestAdapter - xUnit.net: References xunit and xunit.runner.visualstudio

  1. Check the.NET SDK version (dotnet --version) -- this determines how dotnet test integrates with MTP
  2. Check whether a Directory.Build.props file exists at the solution or repo root -- all MTP properties should go there for consistency
  3. Check for vstest.console.exe usage in CI scripts or pipeline definitions
  4. Check for VSTest-specific dotnet test arguments in CI scripts: --filter, --logger, --collect, --settings, --blame*
  5. Run dotnet test to establish a baseline of test pass/fail counts

Step 2: Set up Directory.Build.props

Critical: Set MTP runner properties in Directory.Build.props at 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>. Only MSTest.Sdk sets this automatically. For all other setups (MSTest NuGet packages with EnableMSTestRunner, NUnit with EnableNUnitRunner, xUnit.net with YTest.MTP.XUnit2), prefer setting <OutputType>Exe</OutputType> centrally in Directory.Build.props with a condition that targets only test projects. If you cannot reliably target only test projects from Directory.Build.props, setting <OutputType>Exe</OutputType> per-project is an acceptable exception. Conditioning in Directory.Build.props: Do NOT use Condition="'$(IsTestProject)' == 'true'" -- IsTestProject is set by the test SDK targets later in evaluation and is not available when Directory.Build.props is imported. Use a property that is available early, such as MSBuildProjectName, to target test projects by naming convention. For example, if all test projects end in .Tests: ``xml <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.

Step 3: Enable the framework-specific MTP runner

Each framework has its own opt-in property. Add these in Directory.Build.props for consistency.

MSTest

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.

NUnit

Requires NUnit3TestAdapter 5.0.0 or later.

  1. Update NUnit3TestAdapter to 5.0.0+:
<PackageReference Include="NUnit3TestAdapter" Version="5.0.0" />
  1. Enable the NUnit runner:
<PropertyGroup>
  <EnableNUnitRunner>true</EnableNUnitRunner>
  <OutputType>Exe</OutputType>
</PropertyGroup>
xUnit.net

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.XUnit2 preserves the VSTest --filter syntax, so no filter migration is needed for xUnit.net v2. It also supports --settings for runsettings (xunit-specific configurations only), xunit.runner.json, TRX reporting via --report-trx, and --treenode-filter.
xUnit.net v3

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 --filter syntax. You must translate filters to xUnit.net v3's native filter options (see Step 5).

Step 4: Configure dotnet test integration

The dotnet test integration depends on the.NET SDK version.

.NET 10 SDK and later (recommended)

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.json does not support trailing commas. Ensure the JSON is strictly valid.
.NET 9 SDK and earlier

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 separate dotnet test build arguments from MTP arguments. For example: dotnet test --no-build -- --list-tests.

Step 5: Update dotnet test command-line arguments

VSTest-specific arguments must be translated to MTP equivalents. Build-related arguments (-c, -f, --no-build, --nologo, -v, etc.) are unchanged.

VSTest argumentMTP equivalentNotes
--test-adapter-pathNot applicableMTP does not use external adapter discovery
--blameNot applicable
--blame-crash--crashdumpRequires Microsoft.Testing.Extensions.CrashDump NuGet package
--blame-crash-dump-type <TYPE>--crashdump-type <TYPE>Requires CrashDump extension
--blame-hang--hangdumpRequires 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 coberturaPer-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-trxRequires 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-testsSame
-- <RunSettings args>--test-parameterApplicable only to MSTest and NUnit
Filter migration

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. See the VSTest → MTP filter translation section in the filter-syntax skill for the complete translation table. Key translation example:

# 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-class and --filter-trait, both conditions must match (AND behavior). For complex expressions, use --filter-query with the path-segment syntax. See the xUnit.net query filter language docs for full reference.

Step 6: Install MTP extension packages (if needed)

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" />

Step 7: Update CI/CD pipelines

Azure DevOps

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)'
GitHub Actions

Update dotnet test invocations in workflow files with the same argument translations from Step 5.

Replace vstest.console.exe

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.

Step 8: Handle behavioral differences

Zero tests exit code

VSTest silently succeeds when zero tests are discovered. MTP fails with exit code 8. Options:

  • Pass --ignore-exit-code 8 when running tests
  • Add to Directory.Build.props:
<PropertyGroup>
  <TestingPlatformCommandLineArguments>$(TestingPlatformCommandLineArguments) --ignore-exit-code 8</TestingPlatformCommandLineArguments>
</PropertyGroup>
  • Use environment variable: TESTINGPLATFORM_EXITCODE_IGNORE=8

Step 9: Remove VSTest-only packages (optional)

Once 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 runner
Note: If you need to maintain VSTest compatibility during a transition period, keep these packages.

Step 10: Verify

  1. Run dotnet build -- confirm zero errors
  2. Run dotnet test -- confirm all tests pass
  3. Compare test pass/fail counts to the pre-migration baseline
  4. Run the test executable directly (e.g., ./bin/Debug/net8.0/MyTests.exe) -- confirm it works
  5. Verify CI pipeline produces the expected test result artifacts (TRX files, code coverage, crash dumps)
  6. Test that Test Explorer in Visual Studio (17.14+) or VS Code discovers and runs tests

Validation

  • All test projects use MTP runner (no VSTest-only configuration remains)
  • dotnet build completes with zero errors
  • dotnet test passes all tests and test counts match pre-migration baseline
  • Test executable runs directly (e.g., ./bin/Debug/net8.0/MyTests.exe)
  • CI pipeline produces expected test result artifacts (TRX files, code coverage, crash dumps)
  • Test Explorer in Visual Studio or VS Code discovers and runs tests
  • No vstest.console.exe invocations remain in CI scripts
  • <OutputType>Exe</OutputType> is set for all non-MSTest.Sdk test projects

Common Pitfalls

PitfallSolution
Mixing VSTest and MTP projects in the same solutionMigrate all test projects together -- mixed mode is unsupported
dotnet test arguments ignored on.NET 9 and earlierUse -- to separate build args from MTP args: dotnet test -- --report-trx
Exit code 8 on CI without failuresMTP fails when zero tests run; use --ignore-exit-code 8 or fix test discovery
MSTest.Sdk v4 + vstest.console no longer worksMSTest.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.propsIsTestProject is not yet defined when Directory.Build.props is evaluated -- use $(MSBuildProjectName.EndsWith('.Tests')) (or a similar name-based check) instead

Next Steps

  • Use run-tests for running tests on the new MTP platform
  • Use mtp-hot-reload for iterative test fixing with hot reload on MTP

More Info

平台分布

Codex

35.42%
按下载量换算488

Claude

31.7%
按下载量换算437

Cursor

20.24%
按下载量换算279

Gemini CLI

10.23%
按下载量换算141

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/dotnet/skills --skill migrate-vstest-to-mtp 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills