migrate-mstest-v1v2-to-v3
Ce qu’il fait
Cette skill met à niveau des projets de tests .NET depuis les anciennes versions de MSTest, 1 ou 2, vers MSTest v3. Elle s'adresse aux équipes dont les projets de tests cassent ou se comportent différemment après la mise à jour des paquets.
Quand l’utiliser
- ✓Quand un projet de tests référence encore l'ancien assemblage QualityTools de MSTest v1.
- ✓Quand un projet utilise les paquets NuGet de MSTest v1 ou v2 et doit passer à la v3.
- ✓Quand des erreurs de build ou des erreurs de type DataRow apparaissent après la mise à jour des paquets MSTest vers la v3.
Lien du skill
https://github.com/dotnet/skills/blob/main/plugins/dotnet-test-migration/skills/migrate-mstest-v1v2-to-v3/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
“Mon projet de tests utilise MSTest v2 et je veux passer à MSTest v3. Corrige ce qui casse.”
5 nouveaux skills par semaine. 1 minute de lecture.
Comment ça marche
L'agent vérifie d'abord les versions des paquets et l'état actuel du projet, applique les changements au code source, puis lance les tests pour confirmer que la mise à niveau fonctionne.
Contenu technique (SKILL.md original)
Texte original de l’auteur, en anglais, directement depuis GitHub.
MSTest v1/v2 -> v3 Migration
Migrate a test project from MSTest v1 (assembly references) or MSTest v2 (NuGet 1.x-2.x) to MSTest v3. MSTest v3 is not binary compatible with v1/v2 -- libraries compiled against v1/v2 must be recompiled.
First Action
Inspect the supplied workspace and classify v1, v2, partially migrated v3, or already-complete v3 before answering. Do not search the web or answer from memory first. For an edit request, continue through the requested source changes and validation; for an advice request, answer directly after the classification.
When to Use
- Project references
Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll(MSTest v1) - Project uses
MSTest.TestFramework/MSTest.TestAdapterNuGet 1.x or 2.x - Resolving build errors after updating MSTest packages from v1/v2 to v3 -- including when the packages already read 3.x and only the source or settings still need fixing
- Replacing
.testsettingswith.runsettings - Adopting MSTest.Sdk or in-assembly parallel execution
When Not to Use
- Project already on MSTest v3 with no migration-related build errors and no leftover
.testsettings/<LegacySettings>(fully migrated) - Upgrading v3 to v4 -- use
migrate-mstest-v3-to-v4 - Migrating between frameworks (MSTest to xUnit/NUnit)
Boundary Gate
Check package versions before any edit. If all MSTest references are already 3.x,
no v1/v2-to-v3 error is reported, and no .testsettings or <LegacySettings>
remains, state that migration is complete and make no changes. A 3.x package
version alone does not end the migration -- leftover v1/v2-era settings files or
breaking-change errors are still in scope. Do not consolidate working v3 packages
into the metapackage. Run the existing tests only if verification was requested.
This overrides all steps below.
Inputs
| Input | Required | Description |
|---|---|---|
| Project or solution path | No | The .csproj, .sln, or .slnx entry point. Glob the working directory for it; ask only if nothing is found or several test projects make the target ambiguous |
| Build command | No | How to build (e.g., dotnet build, a repo build script). Auto-detect if not provided |
| Test command | No | How to run tests (e.g., dotnet test). Auto-detect if not provided |
Never open by asking for the project path. A user describing their project in prose is asking a question, not withholding a file -- look on disk first. If there is genuinely no project file, answer for the setup they described rather than replying with only a question.
Open the paths exactly as the search returned them. A glob that answers
./TestProject.csprojmeans the file is there, relative to the working directory -- read it at that path. Do not rebuild it into an absolute path under this skill's own base directory: that directory holdsSKILL.md, not the user's project, so the read fails and the project looks missing when it is not. If a file you just found fails to open, the path you constructed is wrong -- retry with the literal result. Never conclude "there is no project on disk" while a search is still reporting project files, and never scaffold a substitute project from the prose description as a workaround.
Execution Contract
- Skill activation is not a stopping point. Continue with workspace discovery and the requested work in the same task.
- The skill directory contains guidance, not the staged project. Search the current working directory, open the literal paths returned by the search, and retry with another available reader/editor if one tool rejects a valid path.
- Never ask for a path while a glob or directory search can discover it. Ask only after an exhaustive current-workspace search finds no project, or multiple projects make the target genuinely ambiguous.
- Classify the requested deliverable, not isolated verbs: "make the edits", "update this project", or "then build and run" means execute; "what do I need to change?", "what should I expect?", "are the steps the same?", or "show me" means answer, even if the prompt also says upgrade or migrate.
- After changing files, name the detected MSTest version and runner, every file changed, and the exact repaired calls/settings (for example, list each assertion changed to
AreEqual<object>,AreNotEqual<object>, orAreSame<object>). Report the clean test counts. Do not claim VSTest preservation, a build, or passing tests witho
Questions fréquentes
MSTest v3 est-il compatible avec les bibliothèques v1 ou v2 ?
Non. Les bibliothèques compilées avec la v1 ou la v2 doivent être recompilées avant de fonctionner avec la v3.
Touche-t-elle à un projet déjà en v3 ?
Seulement s'il reste des problèmes de migration, comme d'anciens fichiers de réglages.
Convertit-elle les tests vers un autre framework ?
Non. Le passage à un autre framework, comme xUnit ou NUnit, est hors de ce périmètre.
Détails
Description originale de l’auteur
Use this skill before answering or editing whenever an MSTest v1/v2 project is being upgraded or repaired for v3. Triggers include QualityTools assembly references; MSTest.TestFramework/TestAdapter 1.x-2.x; "upgrade to MSTest v3"; comparing v1 and v2 migration paths; choosing MSTest or MSTest.Sdk; CS0411/CS1503 after a v3 package bump; DataRow type mismatch, MSTEST0014, or "Test data doesn't match method parameters"; .testsettings/LegacySettings to .runsettings; timeout changes; and net5.0 or other dropped v3 TFMs. Still use it when packages say 3.x but migration source errors or legacy settin
repo: dotnet/skills
Popularité
- Étoiles GitHub
- 5.8k
- Position au classement
- #14617
- 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.