# Migrate Vstest To Mtp

Use this skill before answering, planning, or editing whenever .NET tests or CI are...

- Repository: https://github.com/managedcode/dotnet-skills (500 stars)
- Category: Testing
- License: MIT
- Last updated: 2026-10-29
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add managedcode/dotnet-skills --skill migrate-vstest-to-mtp -g -a claude-code -y`
Codex: `npx skills add managedcode/dotnet-skills --skill migrate-vstest-to-mtp -g -a codex -y`
Cursor: `npx skills add managedcode/dotnet-skills --skill migrate-vstest-to-mtp -g -a cursor -y`
Gemini CLI: `npx skills add managedcode/dotnet-skills --skill migrate-vstest-to-mtp -g -a gemini-cli -y`

## Description

Use this skill before answering, planning, or editing whenever .NET tests or CI are switching from VSTest to Microsoft.Testing.Platform (MTP), or an MTP migration behaves differently. Triggers include "switch from VSTest"; MSTest/NUnit/xUnit MTP enablement; OutputType=Exe only for test projects in Directory.Build.props; EnableMSTestRunner, EnableNUnitRunner, UseMicrosoftTestingPlatformRunner, or YTest.MTP.XUnit2; .NET 10 global.json test.runner and TestingPlatformDotnetTestSupport; translating VSTest filters, logger, coverage, blame, or dump arguments; replacing VSTest@3; and exit code 8 or zero tests. Also use for xUnit v3 MTP filters during a v2-to-v3 upgrade. Do not use for framework conversion, TFM, UWP, or WinUI.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 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.

## First Action

Inspect the supplied project, `Directory.Build.props`, `global.json`, and CI
files before searching the web or answering from memory. Resolve the framework
and SDK mode first: .NET 9 and earlier use the compatibility property plus the
`--` separator; .NET 10 native MTP uses `global.json`, removes that property,
and passes MTP arguments without the separator. For central properties, never
condition on `IsTestProject` in `Directory.Build.props`; use a property already
available there, such as `MSBuildProjectName`.

> **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 and there is no remaining MTP behavioral difference to resolve (e.g., exit code 8 for zero tests discovered)
- 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

The rest: https://github.com/managedcode/dotnet-skills/blob/HEAD/catalog/Testing/Official-DotNet-Test-Migration/skills/migrate-vstest-to-mtp/SKILL.md
