platform-detection
A background utility that identifies which .NET test runner and framework a project uses by inspecting project configuration files.
Install
mkdir -p .claude/skills/platform-detection && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/17294" && unzip -o skill.zip -d .claude/skills/platform-detection && rm skill.zipInstalls to .claude/skills/platform-detection
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
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.Key capabilities
- →Detect the test platform (VSTest or Microsoft.Testing.Platform)
- →Detect the test framework (MSTest, xUnit, NUnit, TUnit)
- →Inspect `global.json` for test runner settings
- →Examine `.csproj` files for package references and SDKs
- →Check `Directory.Build.props` and `Directory.Packages.props` for test configurations
How it works
The skill analyzes project configuration files like `global.json` and `.csproj` to identify specific package references, SDKs, and MSBuild properties. This information determines the test platform and framework in use.
Inputs & outputs
When to use platform-detection
- →Identifying the test framework for automated migration tasks
- →Determining the correct test runner for CI/CD pipeline configurations
- →Validating project compatibility before hot-reloading tests
- →Scanning dependency files to detect test metapackages
About this skill
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.jsoncontains"test": { "runner": "Microsoft.Testing.Platform" }→ MTP - If
global.jsonhas"runner": "VSTest", or notestsection exists → VSTest
Important: On .NET 10+,
<TestingPlatformDotnetTestSupport>alone does not switch to MTP. Theglobal.jsonrunner setting takes precedence. If the runner is VSTest (or unset), the project uses VSTest regardless ofTestingPlatformDotnetTestSupport.
.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.propsandDirectory.Packages.propsif 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.Sdkdoes 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 usesvstest.consoleunder the hood. Microsoft.Testing.Platform (MTP) is the newer, faster platform. Both can be invoked viadotnet test, but their filter syntax and CLI options differ.
When not to use it
- →Direct invocation by a user
- →When the goal is not to detect test platform or framework
Limitations
- →Not user-invocable
- →Does not perform any actions beyond detection
- →Requires other skills to consume its detection logic
How it compares
This skill provides a standardized, programmatic method for identifying test platforms and frameworks by inspecting project files, which is more reliable and faster than a manual review of project configurations.
Compared to similar skills
platform-detection side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| platform-detection (this skill) | 0 | 20d | No flags | Beginner |
| run-device-tests | 3 | 1mo | Review | Advanced |
| tunit | 0 | 2mo | Review | Intermediate |
| csharp-pro | 9 | 3mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by managedcode
View all by managedcode →You might also like
run-device-tests
dotnet
Build and run .NET MAUI device tests locally with category filtering. Supports iOS, MacCatalyst, Android on macOS; Android, Windows on Windows. Use TestFilter to run specific test categories.
tunit
managedcode
Write, run, or repair .NET tests that use TUnit. Use when a repo uses `TUnit`, `TUnit.Playwright`, `[Test]`, `[Arguments]`, `ClassDataSource`, `SharedType.PerTestSession`, or Microsoft.Testing.Platform-based. USE FOR: the repo uses TUnit; you need to add, run, debug, or repair TUnit tests; the repo
csharp-pro
sickn33
Write modern C# code with advanced features like records, pattern matching, and async/await. Optimizes .NET applications, implements enterprise patterns, and ensures comprehensive testing. Use PROACTIVELY for C# refactoring, performance optimization, or complex .NET solutions.
performance-benchmark
dotnet
Generate and run ad hoc performance benchmarks to validate code changes. Use this when asked to benchmark, profile, or validate the performance impact of a code change in dotnet/runtime.
backend-testing
exceptionless
Backend testing with xUnit, Foundatio.Xunit, integration tests with AppWebHostFactory, FluentClient, ProxyTimeProvider for time manipulation, and test data builders. Keywords: xUnit, Fact, Theory, integration tests, AppWebHostFactory, FluentClient, ProxyTimeProvider, TimeProvider, Foundatio.Xunit, TestWithLoggingBase, test data builders
bunit-test-migration
FritzAndFriends
Migrate bUnit test files from deprecated beta API (1.0.0-beta-10) to bUnit 2.x stable API. Use this when working on .razor test files in BlazorWebFormsComponents.Test that contain old patterns like TestComponentBase, Fixture, or SnapshotTest.