setup-local-sdk
できること
このスキルは、.NET SDKをプロジェクト内のフォルダーにインストールします。コンピューターの.NETの本体を変えずに、プレビュー版や特定のバージョンを試せます。隔離された、再現可能な環境がほしい開発者向けです。
使う場面
- ✓コンピューター全体の.NETの設定を変えずに、.NETのプレビュー版を試したいとき。
- ✓チーム全員が必ず同じ.NET SDKのバージョンを使う必要があるとき。
- ✓チームやCIのために、繰り返し実行できるインストールスクリプトがほしいとき。
スキルのリンク
https://github.com/dotnet/skills/blob/main/plugins/dotnet/skills/setup-local-sdk/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“このプロジェクトフォルダーに.NET 11のプレビューSDKをインストールし、コンピューターの.NETを変えずにテストできるようにしてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、選んだSDKをプロジェクト内のフォルダーにインストールし、そのフォルダーのdotnetコマンドが自動的にそれを使うように、global.jsonを設定します。
技術的な内容(元の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
dotnetcommands from the project root. - Can be deleted to revert (
rm -rf .dotnet/orRemove-Item -Recurse -Force .\.dotnet).
When NOT to use
- User wants a system-wide install — direct to the official installer.
- Host
dotnetis older than v10 —pathsdoesn't exist; explain and stop. - User needs a runtime-only install —
pathsapplies 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
- A .NET 10+ SDK is installed globally — run
dotnet --version; major ≥ 10. - 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:.dotnetfirst (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
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
create-custom-agent
5.8kVisual Studio Codeのカスタムエージェントのファイルを、独自のツール、指示、ほかのエージェントへの引き継ぎとともに作るようエージェントを支援します。
create-skill
5.8k有効な名前、明確な発動の説明、規格に従うSKILL.mdファイルを持つ、新しいエージェントのスキルを作るようエージェントを支援します。
csharp-scripts
5.8k.NETのコマンドラインツールを使って、完全なプロジェクトを作らずに、小さなC#のプログラムを一つのファイルとして実行するようエージェントを支援します。
dotnet-pinvoke
5.8k署名、文字列の扱い、メモリ、安全なハンドルを含めて、ネイティブのC言語またはC++のライブラリを.NETから正しく呼び出すようエージェントを支援します。
似ているスキル
openclaw-update
394k既存のOpenClaw Gatewayを更新するようエージェントを支援します。インストール方法に合った更新方法を選び、セッションを動かし続けます。
diagnose-gateway
394k設定、チャンネル、ポートを確認して、OpenClaw Gatewayが失敗している理由を、何も変更せずに突き止めるようエージェントを支援します。
crabbox-apps
394k一時的なクラウドマシン上でアプリを開いて実行し、そのビューをチャットのサイドパネルに表示するようエージェントを支援します。