Skip to content
Skillpedia
Deploy & cloud (DevOps)5.8k Β· #14654

setup-local-sdk

What it does

This skill installs a .NET SDK into a project-local folder, so you can test a preview or a specific version without changing the computer's main .NET installation. It is for developers who want an isolated or reproducible setup.

When to use it

  • βœ“When you want to try a .NET preview without changing your system-wide .NET installation.
  • βœ“When a project must use one exact .NET SDK version for everyone on the team.
  • βœ“When you want a repeatable install script for a team or CI setup.

Skill link

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

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/dotnet/skills/blob/main/plugins/dotnet/skills/setup-local-sdk/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œInstall the .NET 11 preview SDK inside this project folder so I can test it without changing my computer's .NET.”

5 new skills a week. 1 minute to read.

How it works

The agent installs the chosen SDK into a folder inside the project, then sets global.json so dotnet commands in that folder use it automatically.

Technical content (original SKILL.md)

Original text by the author, straight from 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
FAQ

How do I undo it?

You delete the local SDK folder, which removes the isolated install.

Does it need a newer .NET already installed?

Yes. The global.json paths feature needs a .NET 10 or newer SDK on the host.

Does it install only a runtime?

No. It applies to SDK installs, so runtime-only setups need a different approach.

Details

Original description by the author

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

Popularity

GitHub stars
5.8k
Ranking position
#14654
License
MIT
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills