Langsung ke konten
Skillpedia
Deploy & cloud (DevOps)5.8k Β· #14654

setup-local-sdk

Fungsinya

Skill ini memasang SDK .NET ke folder lokal proyek, sehingga Anda bisa menguji pratinjau atau versi tertentu tanpa mengubah instalasi .NET utama di komputer. Skill ini untuk pengembang yang menginginkan pengaturan yang terisolasi atau dapat direproduksi.

Kapan dipakai

  • βœ“Saat Anda ingin mencoba pratinjau .NET tanpa mengubah instalasi .NET di seluruh sistem.
  • βœ“Saat sebuah proyek harus memakai satu versi SDK .NET yang tepat untuk semua anggota tim.
  • βœ“Saat Anda ingin skrip instalasi yang bisa diulang untuk tim atau pengaturan CI.

Link skill

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

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/dotnet/skills/blob/main/plugins/dotnet/skills/setup-local-sdk/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œPasang SDK pratinjau .NET 11 di dalam folder proyek ini agar saya bisa mengujinya tanpa mengubah .NET di komputer saya.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent memasang SDK yang dipilih ke folder di dalam proyek, lalu mengatur global.json agar perintah dotnet di folder itu otomatis memakainya.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
Pertanyaan umum

Bagaimana cara membatalkannya?

Anda menghapus folder SDK lokal, yang menghapus instalasi terisolasi.

Apakah perlu .NET yang lebih baru sudah terpasang?

Ya. Fitur path di global.json membutuhkan SDK .NET 10 atau yang lebih baru di host.

Apakah skill ini hanya memasang runtime?

Tidak. Skill ini untuk instalasi SDK, sehingga pengaturan khusus runtime membutuhkan pendekatan lain.

Detail

Deskripsi asli dari pembuat

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

Popularitas

Bintang GitHub
5.8k
Peringkat
#14654
Lisensi
MIT
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa