mtp-hot-reload
यह क्या करती है
यह स्किल Microsoft Testing Platform प्रोजेक्ट के लिए एक लंबे समय तक चलने वाला टेस्ट होस्ट सेट अप करके चलाती है, ताकि कोड बदलने पर टेस्ट शुरू से शुरू किए बिना फिर चलें। यह उन डेवलपर्स के लिए है जो बार-बार कोड बदलकर फ़ेल होते टेस्ट को दोबारा चलाते हैं।
कब इस्तेमाल करें
- ✓जब आप चाहते हैं कि Microsoft Testing Platform प्रोजेक्ट में हर बार फ़ाइल सेव करने पर टेस्ट अपने-आप फिर चलें।
- ✓जब आप किसी फ़ेल होते टेस्ट को ठीक कर रहे हों और तेज़ बदलाव-और-जाँच का चक्र चाहिए।
- ✓जब किसी ऐसे टेस्ट प्रोजेक्ट में हॉट रीलोड सेट करना हो जो Microsoft Testing Platform इस्तेमाल करता है।
Skill का लिंक
https://github.com/dotnet/skills/blob/main/plugins/dotnet-test/skills/mtp-hot-reload/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरा टेस्ट प्रोजेक्ट ऐसा सेट कीजिए कि हर बार बदलाव सेव करने पर फ़ेल होते टेस्ट फिर चलें।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट जाँचता है कि प्रोजेक्ट कौन-सा टेस्ट प्लेटफ़ॉर्म इस्तेमाल करता है, कंसोल होस्ट को हॉट रीलोड के लिए सेट करता है, और वह कमांड देता है जिससे होस्ट आपके काम करते समय चलता रहे।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
MTP Hot Reload for Iterative Test Fixing
Set up and use a long-lived Microsoft Testing Platform host that applies code edits and automatically reruns tests.
When to Use
- User explicitly asks for test hot reload
- User wants a host to stay running and automatically rerun after repeated edits
- User needs to set up MTP hot reload in their project
When Not to Use
- User needs to write new tests from scratch (use general coding assistance)
- User needs to diagnose why a test is failing (use diagnostic skills)
- User asks about Visual Studio or VS Code Test Explorer hot reload or an IDE-integrated rerun experience (different feature, not MTP console-host hot reload)
- User asks whether the editor can auto-rerun affected tests after source edits without using an MTP console host
- User wants one normal run without rebuilding (use
run-tests) - User needs CI/CD pipeline configuration
Inputs
| 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 |
Response sizing
- If setup is already complete and the user asks only which command to use,
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. - If the package is already installed, show only the remaining enable-and-run steps. Do not suggest reinstalling it or add optional persistence/recovery paths unless requested.
- For a named test, identify the framework and return one runnable command with
that framework's filter syntax. Never substitute MSTest/NUnit
--filterfor xUnit v3--filter-methodor TUnit--treenode-filter. - A directly launched MTP host is itself the persistent watcher:
dotnet runstays alive and the HotReload extension reacts to edits. Do not replace it withdotnet watch runfor the normal MTP path; reservedotnet watchfor the explicit restart fallback below.
Workflow
Step 1: Detect the platform before changing anything
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.
Step 2: Add the hot reload NuGet package
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.
Step 3: Enable hot reload
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"
}
}
}
}
Step 4: Run the tests with hot reload
Run the test project directly (not through `dotnet t
अक्सर पूछे जाने वाले सवाल
क्या यह Visual Studio Test Explorer के साथ काम करती है?
नहीं। यह कंसोल होस्ट के तरीके को कवर करती है। IDE के टेस्ट एक्सप्लोरर में हॉट रीलोड एक अलग फ़ीचर है।
क्या मैं चुन सकता हूँ कि कौन-से टेस्ट दोबारा चलें?
हाँ। स्किल फ़िल्टर को भी कवर करती है, ताकि लूप खास टेस्ट पर केंद्रित रह सके।
अगर प्रोजेक्ट VSTest इस्तेमाल करता है तो?
स्किल एक वैकल्पिक तरीका बताती है, जो हॉट रीलोड सपोर्ट न होने पर आपके प्रोजेक्ट को बदले बिना काम करता है।
जानकारी
लेखक का मूल विवरण
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.
repo: dotnet/skills
लोकप्रियता
- GitHub स्टार
- 5.8k
- रैंकिंग में स्थान
- #14633
- लाइसेंस
- MIT
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
create-custom-agent
5.8kयह आपके एजेंट को VS Code के custom agent फ़ाइलें बनाने देती है, जिनके अपने tools, निर्देश और दूसरे agents को handoffs होते हैं।
create-skill
5.8kयह आपके एजेंट को सही नाम, साफ़ trigger विवरण और मानक के अनुसार SKILL.md फ़ाइल वाली नई agent skill बनाने में मदद करती है।
csharp-scripts
5.8kयह आपके एजेंट को .NET command line टूल से एक छोटा C# प्रोग्राम एकल फ़ाइल के रूप में चलाने देती है, पूरा प्रोजेक्ट बनाए बिना।
dotnet-pinvoke
5.8kयह आपके एजेंट को .NET से native C या C++ libraries सही तरीके से कॉल करने में मदद करती है, जिसमें signatures, string संभालना, memory और सुरक्षित handles शामिल हैं।
मिलती-जुलती skills
test-driven-development
311kयह आपके एजेंट को किसी भी फ़ीचर या सुधार से पहले पहले असफल होने वाला टेस्ट लिखना, उसे असफल होते देखना, फिर पास करने वाला सबसे छोटा कोड लिखना सिखाती है।
verification-before-completion
311kयह आपके एजेंट को किसी काम, सुधार या build के पूरा या पास होने का दावा करने से पहले असली जांच चलाकर उसका आउटपुट पढ़ना सिखाती है।
migrate-to-shoehorn
310kआपकी टेस्ट फ़ाइलों में जोखिम भरे type casts की जगह shoehorn लाइब्रेरी लगाती है, ताकि टेस्ट अधूरे डेटा से भी type checks पास कर सकें।