मुख्य सामग्री पर जाएँ
Skillpedia
डिप्लॉय और क्लाउड (DevOps)5.8k · #14654

setup-local-sdk

यह क्या करती है

यह स्किल .NET SDK को एक प्रोजेक्ट-स्थानीय फ़ोल्डर में इंस्टॉल करती है, ताकि आप कंप्यूटर के मुख्य .NET को बदले बिना प्रीव्यू या खास वर्शन आज़मा सकें। यह उन डेवलपर्स के लिए है जिन्हें अलग-थलग या दोहराने योग्य सेटअप चाहिए।

कब इस्तेमाल करें

  • ✓जब आप सिस्टम-व्यापी .NET इंस्टॉल बदले बिना .NET प्रीव्यू आज़माना चाहते हों।
  • ✓जब किसी प्रोजेक्ट को टीम के हर सदस्य के लिए एक ही .NET SDK वर्शन चाहिए।
  • ✓जब टीम या CI सेटअप के लिए दोहराने योग्य इंस्टॉल स्क्रिप्ट चाहिए।

Skill का लिंक

https://github.com/dotnet/skills/blob/main/plugins/dotnet/skills/setup-local-sdk/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/dotnet/skills/blob/main/plugins/dotnet/skills/setup-local-sdk/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“इस प्रोजेक्ट फ़ोल्डर के अंदर .NET 11 प्रीव्यू SDK इंस्टॉल कीजिए, ताकि मेरे कंप्यूटर का .NET बदले बिना मैं उसे आज़मा सकूँ।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

एजेंट चुना हुआ SDK प्रोजेक्ट के अंदर एक फ़ोल्डर में इंस्टॉल करता है, फिर global.json सेट करता है ताकि उस फ़ोल्डर में dotnet कमांड अपने-आप उसी को इस्तेमाल करें।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

setup-local-sdk

Purpose

Guide the user through installing a .NET SDK into a project-local .dotnet/ directory and wiring it up via the global.json paths feature (.NET 10+). The examples use .NET 11, but this works with any version — prerelease or stable.

The result is a fully isolated SDK that:

  • Does not modify the system-wide .NET installation.
  • Is picked up automatically by dotnet commands from the project root.
  • Can be deleted to revert (rm -rf .dotnet/ or Remove-Item -Recurse -Force .\.dotnet).

When NOT to use

  • User wants a system-wide install — direct to the official installer.
  • Host dotnet is older than v10 — paths doesn't exist; explain and stop.
  • User needs a runtime-only install — paths applies to SDK resolution only.

Inputs / Prerequisites

Input Required Default Notes
Channel or version No 11.0 e.g. 11.0, STS, LTS, or an exact version like 11.0.100-preview.2.26159.112
Quality No preview One of: daily, preview, ga
jq No — Optional for bash team scripts when patching an existing global.json; without it, do not overwrite the file

Prerequisites

  1. A .NET 10+ SDK is installed globally — run dotnet --version; major ≥ 10.
  2. curl (macOS/Linux) or PowerShell (Windows) is available.

Workflow

Step 1 — Clarify what to install

If the user didn't specify, ask what .NET SDK version they want (e.g., "latest .NET 11 preview" or an exact version like 11.0.100-preview.2.26159.112). Map the answer to --channel/--quality or --version flags.

Step 2 — Verify .NET 10+ host

If the user already provided dotnet --version output, treat that as the authoritative version for their machine. Do not override it with the agent workspace's version; if the two differ, explain that the workspace differs and continue advising for the user's machine.

dotnet --version

If major version < 10, stop before downloading anything: the paths feature requires a .NET 10+ host SDK. Tell the user to install .NET 10 or later system-wide first, then return to the local SDK setup.

Step 3 — Detect operating system

Run uname -s 2>/dev/null. If it succeeds (including MINGW*, MSYS*, CYGWIN* — these are bash-capable environments like Git Bash) → use bash/dotnet-install.sh. If it fails (native Windows without Git Bash) → use PowerShell/dotnet-install.ps1.

Step 4 — Check for existing local SDK

macOS / Linux:

test -d .dotnet && echo "exists" || echo "not found"

Windows (PowerShell):

if (Test-Path -LiteralPath .\.dotnet) { "exists" } else { "not found" }

If .dotnet/ exists, ask: update with the new version, or skip and keep it?

Step 5 — Download and run the install script

macOS / Linux:

INSTALL_SCRIPT="$(mktemp "${TMPDIR:-/tmp}/dotnet-install.XXXXXX")"
trap 'rm -f "$INSTALL_SCRIPT"' EXIT
curl -fsSL https://dot.net/v1/dotnet-install.sh -o "$INSTALL_SCRIPT"
bash "$INSTALL_SCRIPT" --channel <CHANNEL> --quality <QUALITY> --install-dir .dotnet

Windows (PowerShell):

$installScript = Join-Path $env:TEMP "dotnet-install-$([guid]::NewGuid()).ps1"
try {
    Invoke-WebRequest -Uri 'https://dot.net/v1/dotnet-install.ps1' -OutFile $installScript
    & $installScript -Channel <CHANNEL> -Quality <QUALITY> -InstallDir .dotnet
}
finally {
    if (Test-Path -LiteralPath $installScript) {
        Remove-Item -LiteralPath $installScript -Force
    }
}

For exact versions: use --version <VERSION> (bash) or -Version <VERSION> (PowerShell) instead of channel/quality flags. The install scripts are from Microsoft's official URLs: https://dot.net/v1/dotnet-install.sh and https://dot.net/v1/dotnet-install.ps1.

Step 6 — Identify the installed version

./.dotnet/dotnet --version          # macOS/Linux
.\.dotnet\dotnet.exe --version      # Windows

Record the exact version string (e.g., 11.0.100-preview.2.26159.112) for global.json.

Step 7 — Create or update global.json

{
  "sdk": {
    "version": "<INSTALLED_VERSION>",
    "allowPrerelease": true,
    "rollForward": "latestFeature",
    "paths": [".dotnet", "$host$"],
    "errorMessage": "Required .NET SDK not found. Run ./install-dotnet.sh (or .ps1) to install it locally."
  }
}
  • paths: .dotnet first (local priority), $host$ = system-wide fallback.
  • rollForward: "latestFeature": use
अक्सर पूछे जाने वाले सवाल

इसे कैसे हटाऊँ?

स्थानीय SDK फ़ोल्डर हटा दीजिए, इससे अलग-थलग इंस्टॉल हट जाता है।

क्या इसके लिए पहले से नया .NET इंस्टॉल होना ज़रूरी है?

हाँ। global.json पाथ फ़ीचर के लिए होस्ट पर .NET 10 या नया SDK चाहिए।

क्या यह सिर्फ़ रनटाइम इंस्टॉल करती है?

नहीं। यह SDK इंस्टॉल पर लागू होती है, इसलिए केवल-रनटाइम सेटअप के लिए अलग तरीका चाहिए।

जानकारी

लेखक का मूल विवरण

Install a .NET SDK locally for safe preview testing, specific-version pinning, or reproducible team setups — without modifying the system-wide installation. USE FOR: trying .NET previews safely, testing specific SDK versions, installing MAUI or other workloads on a preview, updating or replacing an existing local SDK, creating reproducible team/CI install scripts, configuring global.json paths. DO NOT USE FOR: system-wide SDK installs, .NET hosts older than 10, runtime-only installs, or projects not using SDK-style commands.

repo: dotnet/skills

लोकप्रियता

GitHub स्टार
5.8k
रैंकिंग में स्थान
#14654
लाइसेंस
MIT
अपडेट की गई
2/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills