Skip to content
Back to skills

001 Platform Detection

ASecurity

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.

  • 7 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added September 12, 2026
ai-agentstesting

Works with

  • cli

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add bouclem/skills --skill 001-platform-detection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 001 Platform Detection?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 001 Platform Detection
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/bouclem-001-platform-detection/badge)](https://www.skillsdirectory.com/skills/bouclem-001-platform-detection)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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."
user-invocable: false
license: MIT
---

# Test Platform and Framework Detection

Determine **which test platform** (VSTest or Microsoft.Testing.Platform) and **which test framework** (MSTest, xUnit, NUnit, TUnit) a project uses.

**Detection files to always check** (in order): `global.json` → `.csproj` → `Directory.Build.props` → `Directory.Packages.props`

## Detecting the test framework

Read the `.csproj` file **and** `Directory.Build.props` / `Directory.Packages.props` (for centrally managed dependencies) and look for:

| Package or SDK reference | Framework |
|--------------------------|-----------|
| `MSTest` (metapackage, recommended) or `<Sdk Name="MSTest.Sdk">` | MSTest |
| `MSTest.TestFramework` + `MSTest.TestAdapter` | MSTest (also valid for v3/v4) |
| `xunit`, `xunit.v3`, `xunit.v3.mtp-v1`, `xunit.v3.mtp-v2`, `xunit.v3.core.mtp-v1`, `xunit.v3.core.mtp-v2` | xUnit |
| `NUnit` + `NUnit3TestAdapter` | NUnit |
| `TUnit` | TUnit (MTP only) |

## Detecting the test platform

The detection logic depends on the .NET SDK version. Run `dotnet --version` to determine it.

### .NET SDK 10+

On .NET 10+, the `global.json` `test.runner` setting is the **authoritative source**:

- If `global.json` contains `"test": { "runner": "Microsoft.Testing.Platform" }` → **MTP**
- If `global.json` has `"runner": "VSTest"`, or no `test` section exists → **VSTest**

> **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`.

### .NET SDK 8 or 9

On older SDKs, check these signals in priority order:

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

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

**2. Check project-level signals:**

| Signal | Platform |
|--------|----------|
| `<Sdk Name="MSTest.Sdk">` as project SDK | **MTP** by default |
| `<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>` | **MTP** runner (xUnit) |
| `<EnableMSTestRunner>true</EnableMSTestRunner>` | **MTP** runner (MSTest) |
| `<EnableNUnitRunner>true</EnableNUnitRunner>` | **MTP** runner (NUnit) |
| `Microsoft.Testing.Platform` package referenced directly | **MTP** |
| `TUnit` package referenced | **MTP** (TUnit is MTP-only) |

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

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.