migrate-vstest-to-mtp
Ce qu’il fait
Cette skill fait passer les projets de tests .NET de l'ancien lanceur VSTest à Microsoft.Testing.Platform, une plateforme de test plus récente. Elle s'adresse aux équipes qui veulent changer de lanceur et mettre à jour leurs commandes de test et leurs pipelines CI.
Quand l’utiliser
- ✓Quand vous voulez passer une solution de tests .NET de VSTest à Microsoft.Testing.Platform.
- ✓Quand les tests doivent s'exécuter comme des exécutables directs ou fonctionner avec dotnet run ou dotnet watch.
- ✓Quand une exécution de tests se comporte différemment après le passage et que les pipelines CI doivent être mis à jour.
Lien du skill
https://github.com/dotnet/skills/blob/main/plugins/dotnet-test-migration/skills/migrate-vstest-to-mtp/SKILL.mdCopiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.
Comment l’utiliser
Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.
Message prêt à coller
Pour Claude Code, Codex ou Cursor : lancez-la dans le dossier du projet et le skill est installé.
Téléchargez le SKILL.md et placez-le dans le dossier de skills de votre agent.
Exemple de demande à votre IA
“Fais passer mes projets de tests .NET de VSTest à Microsoft.Testing.Platform et mets à jour mon pipeline CI.”
5 nouveaux skills par semaine. 1 minute de lecture.
Comment ça marche
L'agent vérifie la version du framework et du SDK, applique les bons réglages et la syntaxe de commande correcte, puis met à jour les étapes du pipeline pour que les tests s'exécutent sur la nouvelle plateforme.
Contenu technique (SKILL.md original)
Texte original de l’auteur, en anglais, directement depuis GitHub.
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.exewithdotnet teston MTP - Updating CI/CD pipelines from the VSTest task to the .NET Core CLI task
- Updating
dotnet testarguments 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-v3ormigrate-mstest-v3-to-v4
Inputs
| Input | Required | Description |
|---|---|---|
| Project or solution path | No | The .csproj, .sln, or .slnx entry point containing test projects. Discover it yourself by globbing the working directory; ask only when nothing is found or the choice is genuinely ambiguous |
| 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. Prefer the repository's global.json or explicitly stated CI SDK; use host dotnet --version only when the repository does not pin or state one |
| CI/CD pipeline files | No | Paths to pipeline definitions that invoke vstest.console or dotnet test |
Execution and Answer Contract
- Discover project, props,
global.json, and pipeline files in the current working directory. Open literal search results; the skill directory is not the user's repository. Continue after skill activation and do not ask for a discoverable path. - For an implementation request, edit the files, then validate the effective MSBuild properties, the translated command, test counts, and requested artifacts. For a question, provide one exact command/configuration for the detected SDK and framework rather than a menu of near-equivalents.
- Preserve all build arguments and avoid introducing
--no-build, new settings files, or unrelated package upgrades. Never retain--settings <file>unless that file exists. - For .NET 9 and earlier, show the
--separator. For .NET 10 native MTP mode, explicitly say to remove it. - When suppressing exit code 8 is intentional, warn that broad suppression can hide an accidental empty run caused by a bad filter; scope it to the known zero-test project/configuration.
- For an exit-code-8 question, show all three concrete forms:
--ignore-exit-code 8,TestingPlatformCommandLineArguments, andTESTINGPLATFORM_EXITCODE_IGNORE=8. - For xUnit v3 filters, give the directly usable
--filter-class/--filter-method/--filter-traitcommand and explain AND behavior. When the resolved xUnit version supports it, include--filter-querypath syntax for complex expressions and link the xUnit query-filter documentation. - When translating reporters, coverage, or dumps, name each required package in the answer; a correct-looking option without its owning extension package is incomplete.
- Final results must name the framework runner opt-in, repository-selected SDK integration mode, exact translated command,
Questions fréquentes
VSTest et MTP peuvent-ils coexister dans une même solution ?
Non. La skill indique que mélanger les deux dans une même solution ou configuration d'exécution n'est pas pris en charge.
La syntaxe des commandes change-t-elle ?
Oui. La skill convertit les arguments VSTest dans la syntaxe qu'utilise la nouvelle plateforme.
Couvre-t-elle le Native AOT ?
Oui. Elle couvre l'activation du Native AOT ou de l'exécution des tests allégée par le trimming.
Détails
Description originale de l’auteur
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 ze
repo: dotnet/skills
Popularité
- Étoiles GitHub
- 5.8k
- Position au classement
- #14620
- Licence
- MIT
- Mis à jour
- 02/11/2026
Commentaires
- …
Autres skills de ce dépôt
create-custom-agent
5.8kAide votre agent à créer des fichiers d'agents personnalisés pour VS Code, avec leurs propres outils, instructions et transferts vers d'autres agents.
create-skill
5.8kAide votre agent à créer une nouvelle skill d'agent avec un nom valide, une description de déclenchement claire et un fichier SKILL.md conforme à la norme.
csharp-scripts
5.8kAide votre agent à exécuter un petit programme C# en un seul fichier avec l'outil en ligne de commande .NET, sans créer de projet complet.
dotnet-pinvoke
5.8kAide votre agent à appeler correctement des bibliothèques natives C ou C++ depuis .NET, en couvrant les signatures, la gestion des chaînes, la mémoire et les handles sûrs.
Skills similaires
test-driven-development
311kApprend à votre agent à écrire d'abord un test qui échoue, à le voir échouer, puis à écrire le code minimal qui le fait réussir, avant de construire toute fonctionnalité ou correction.
verification-before-completion
311kApprend à votre agent à lancer de véritables contrôles et à lire leurs résultats avant d'affirmer qu'une tâche, une correction ou une compilation est terminée ou réussie.
migrate-to-shoehorn
310kRemplace les conversions de type risquées dans vos fichiers de test par la bibliothèque shoehorn, afin que les tests utilisent des données partielles et passent les contrôles de types.