csharp-scripts
Run file-based C# apps with the .NET CLI when the user explicitly wants C#/.NET code without creating a project. Use for C# language/API experiments, one-file…
Set up or recover MTP hot reload for a long-lived console-host edit/re-run loop in a Microsoft Testing Platform project. Use for explicit MTP console requests such as "enable hot reload", "dotnet run to rerun on edit", or unsupported/rude edits. Covers setup, run/watch,
$ npx -y skills add dotnet/skills --skill mtp-hot-reload --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/mtp-hot-reloadContext preview
The summary Claude sees to decide when to auto-load this skill.
Set up or recover MTP hot reload for a long-lived console-host edit/re-run loop in a Microsoft Testing Platform project. Use for explicit MTP console requests such as "enable hot reload", "dotnet run to rerun on edit", or unsupported/rude edits. Covers setup, run/watch,
name: mtp-hot-reload description: > Set up or recover MTP hot reload for a long-lived console-host edit/re-run loop in a Microsoft Testing Platform project. Use for explicit MTP console requests such as "enable hot reload", "dotnet run to rerun on edit", or unsupported/rude edits. Covers setup, run/watch, restarts, filters, and the VSTest no-mutation fallback. For one-time runs, exact commands, filter errors, TRX/dumps, or merely a failing test, use run-tests. Do not use when Test Explorer or an IDE should rerun tests without an MTP console host. Excludes editor integration, CI, and writing/debugging tests. license: MIT
Set up and use a long-lived Microsoft Testing Platform host that applies code edits and automatically reruns tests.
| Input | Required | Description | |-------|----------|-------------| | Test project path | No | Path to the test project (.csproj). Defaults to current directory. | | Failing test name or filter | No | Specific test(s) to iterate on |
return one `dotnet run --project <path>` command and one sentence explaining that it starts the persistent host. Do not repeat package, launch profile, or rude-edit guidance.
steps. Do not suggest reinstalling it or add optional persistence/recovery paths unless requested.
that framework's filter syntax. Never substitute MSTest/NUnit `--filter` for xUnit v3 `--filter-method` or TUnit `--treenode-filter`.
stays alive and the HotReload extension reacts to edits. Do not replace it with `dotnet watch run` for the normal MTP path; reserve `dotnet watch` for the explicit restart fallback below.
Hot reload requires MTP. It does **not** work with VSTest.
Follow the complete evaluated-property procedure in the `platform-detection` skill. Read imported props and package versions as well as the project file. Do this before installing packages, editing files, or returning an MTP launch command.
**Hard stop for VSTest:** report that MTP hot reload is unavailable for the project as configured and stop the MTP setup path. Do not install the extension, create `launchSettings.json`, set the environment variable, change runner properties/packages, or return a `dotnet run` hot-reload command. Never turn a setup request into an implicit VSTest-to-MTP migration.
Offer one valid non-MTP fallback that preserves the project:
dotnet watch --project <project-path> test
This rebuilds and reruns the existing VSTest project when files change; it is not MTP hot reload. Offer an explicit migration as a separate option, but do not perform it unless the user asks. Exact one-shot test commands remain owned by `run-tests`.
First inspect the effective package references. If `Microsoft.Testing.Extensions.HotReload` is already installed, preserve its version and skip this step. Otherwise install it:
dotnet add <project-path> package Microsoft.Testing.Extensions.HotReload
> **Note**: When using `Microsoft.Testing.Platform.MSBuild` (included transitively by MSTest, NUnit, and xUnit runners), the extension is auto-registered when you install its NuGet package -- no code changes needed.
Hot reload is activated by setting the `TESTINGPLATFORM_HOTRELOAD_ENABLED` environment variable to `1`.
**Option A -- Set it in the shell before running tests:**
# PowerShell $env:TESTINGPLATFORM_HOTRELOAD_ENABLED = "1" # bash/zsh export TESTINGPLATFORM_HOTRELOAD_ENABLED=1
**Option B -- Add it to `launchSettings.json` (recommended for repeatable use):**
Create or update `Properties/launchSettings.json` in the test project:
{
"profiles": {
"<ProjectName>": {
"commandName": "Project",
"environmentVariables": {
"TESTINGPLATFORM_HOTRELOAD_ENABLED": "1"
}
}
}
}Run the test project directly (not through `dotnet test`) to use hot reload in console mode:
dotnet run --project <project-path>
To filter to specific failing tests, pass the filter after `--`. The syntax depends on the test framework -- see the `filter-syntax` skill for full details. Quick examples:
| Framework | Filter syntax | |-----------|--------------| | MSTest | `dotnet run --project <path> -- --filter "FullyQualifiedName~TestMethodName"` | | NUnit | `dotnet run --project <path> -- --filter "FullyQualifiedName~TestMethodName"` | | xUnit v3 | `dotnet run --project <path> -- --filter-method "*TestMethodName"` | | TUnit | `dotnet run --project <path> -- --treenode-filter "/*/*/ClassName/TestMethodName"` |
The test host will start, run the tests, and **remain running** waiting for code changes.
1. Edit the source code (test code or pr
This repository contains the .NET team's curated set of portable skills and host-specific custom agents for coding agents. For information about the Agent Skills standard, see agentskills.io.
Repo: dotnet/skills
Run file-based C# apps with the .NET CLI when the user explicitly wants C#/.NET code without creating a project. Use for C# language/API experiments, one-file…
Correctly call native (C/C++) libraries from .NET using P/Invoke and LibraryImport. Covers function signatures, string marshalling, memory lifetime,…
Set up NuGet trusted publishing (OIDC) on a GitHub Actions repo — replaces long-lived API keys with short-lived tokens. USE FOR: trusted publishing, NuGet…
Design, implement, optimize, and review SIMD code in .NET. USE FOR: vectorizing scalar loops with TensorPrimitives, Vector64/128/256/512, or platform hardware…
Guides technology selection and implementation of AI and ML features in .NET 8+ applications using ML.NET, Microsoft.Extensions.AI (MEAI), Microsoft Agent…
Configure OpenTelemetry distributed tracing, metrics, and logging in ASP.NET Core using the .NET OpenTelemetry SDK. Use when adding observability, setting up…