{
  "schema": "https://ai-atoms.com/schemas/skill-v1.json",
  "type": "skill",
  "id": "skill/platform-detection",
  "version": "1.0.0",
  "name": "platform-detection",
  "description": "Reference data for detecting the test platform (VSTest vs Microsoft.Testing.Platform) and test framework (MSTest, xUnit, NUnit, TUnit) from project files. DO NOT USE directly — loaded by run-tests, mtp-hot-reload, and migrate-vstest-to-mtp when they need detection logic.",
  "system_prompt_fragment": "# Test Platform and Framework Detection\n\nDetermine **which test platform** (VSTest or Microsoft.Testing.Platform) and **which test framework** (MSTest, xUnit, NUnit, TUnit) a project uses.\n\n**Detection files to always check** (in order): `global.json` → `.csproj` → `Directory.Build.props` → `Directory.Packages.props`\n\n## Detecting the test framework\n\nRead the `.csproj` file **and** `Directory.Build.props` / `Directory.Packages.props` (for centrally managed dependencies) and look for:\n\n| Package or SDK reference | Framework |\n|--------------------------|-----------|\n| `MSTest` (metapackage, recommended) or `<Sdk Name=\"MSTest.Sdk\">` | MSTest |\n| `MSTest.TestFramework` + `MSTest.TestAdapter` | MSTest (also valid for v3/v4) |\n| `xunit`, `xunit.v3`, `xunit.v3.mtp-v1`, `xunit.v3.mtp-v2`, `xunit.v3.core.mtp-v1`, `xunit.v3.core.mtp-v2` | xUnit |\n| `NUnit` + `NUnit3TestAdapter` | NUnit |\n| `TUnit` | TUnit (MTP only) |\n\n## Detecting the test platform\n\nThe detection logic depends on the .NET SDK version. Run `dotnet --version` to determine it.\n\n### .NET SDK 10+\n\nOn .NET 10+, the `global.json` `test.runner` setting is the **authoritative source**:\n\n- If `global.json` contains `\"test\": { \"runner\": \"Microsoft.Testing.Platform\" }` → **MTP**\n- If `global.json` has `\"runner\": \"VSTest\"`, or no `test` section exists → **VSTest**\n\n> **Important**: On .NET 10+, `<TestingPlatformDotnetTestSupport>` alone does **not** switch to MTP. The `global.json` runner setting takes precedence. If the runner is VSTest (or unset), the project uses VSTest regardless of `TestingPlatformDotnetTestSupport`.\n\n### .NET SDK 8 or 9\n\nOn older SDKs, check these signals in priority order:\n\n**1. Check the `<TestingPlatformDotnetTestSupport>` MSBuild property.** Look in the `.csproj`, `Directory.Build.props`, **and** `Directory.Packages.props`. If set to `true` in **any** of these files, the project uses **MTP**.\n\n> **Critical**: Always read `Directory.Build.props` and `Directory.Packages.props` if they exist. MTP properties are frequently set there instead of in the `.csproj`, so checking only the project file will miss them.\n\n**2. Check project-level signals:**\n\n| Signal | Platform |\n|--------|----------|\n| `<Sdk Name=\"MSTest.Sdk\">` as project SDK | **MTP** by default |\n| `<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>` | **MTP** runner (xUnit) |\n| `<EnableMSTestRunner>true</EnableMSTestRunner>` | **MTP** runner (MSTest) |\n| `<EnableNUnitRunner>true</EnableNUnitRunner>` | **MTP** runner (NUnit) |\n| `Microsoft.Testing.Platform` package referenced directly | **MTP** |\n| `TUnit` package referenced | **MTP** (TUnit is MTP-only) |\n\n> **Note**: The presence of `Microsoft.NET.Test.Sdk` does **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.\n> **Key distinction**: VSTest is the classic platform that uses `vstest.console` under the hood. Microsoft.Testing.Platform (MTP) is the newer, faster platform. Both can be invoked via `dotnet test`, but their filter syntax and CLI options differ.",
  "applicable_domains": [
    "code",
    "dotnet",
    "engineering"
  ],
  "invocation": [
    "/platform-detection"
  ],
  "tags": [
    "dotnet-test",
    "dotnet",
    "csharp",
    "microsoft"
  ],
  "authored_by": "anthropics",
  "source_url": "https://github.com/dotnet/skills/blob/main/plugins/dotnet-test/skills/platform-detection/SKILL.md",
  "lifecycle": "stable",
  "category": "dotnet",
  "provenance": {
    "source": "dotnet/skills",
    "source_url": "https://github.com/dotnet/skills/blob/main/plugins/dotnet-test/skills/platform-detection/SKILL.md",
    "author": "Microsoft / .NET Foundation",
    "license": "MIT",
    "notes": "Imported by scripts/import-anthropic-skills.py."
  }
}