[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7D0PWGWCYBQK10R3P6PPC6X":3,"skill-same:01M7D0PWGWCYBQK10R3P6PPC6X":44},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M7D0PWGWCYBQK10R3P6PPC6X","setup-local-sdk",null,"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\u002FCI 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.","itsmejay18\u002FAI-Skills-for-My-Development-Stack","itsmejay18","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F167779943?v=4","01M7CZRFC6DDZA5V2CX8WDSZED","Jay Jemino Ababon ","01M7CZRFCVRNW1SFHSQXEJ3CQN",0,"MIT","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F02-CSharp-WPF-Desktop-Development\u002Fsetup-local-sdk\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: setup-local-sdk\nlicense: MIT\ndescription: >\n  Install a .NET SDK locally for safe preview testing, specific-version pinning, or\n  reproducible team setups — without modifying the system-wide installation.\n  USE FOR: trying .NET previews safely, testing specific SDK versions, installing MAUI\n  or other workloads on a preview, updating or replacing an existing local SDK,\n  creating reproducible team\u002FCI install scripts, configuring global.json paths.\n  DO NOT USE FOR: system-wide SDK installs, .NET hosts older than 10, runtime-only\n  installs, or projects not using SDK-style commands.\n---\n\n# setup-local-sdk\n\n## Purpose\n\nGuide the user through installing a .NET SDK into a project-local `.dotnet\u002F`\ndirectory and wiring it up via the `global.json` `paths` feature (.NET 10+).\nThe examples use .NET 11, but this works with any version — prerelease or stable.\n\nThe result is a fully isolated SDK that:\n- Does **not** modify the system-wide .NET installation.\n- Is picked up automatically by `dotnet` commands from the project root.\n- Can be deleted to revert (`rm -rf .dotnet\u002F` or `Remove-Item -Recurse -Force .\\.dotnet`).\n\n## When NOT to use\n\n- User wants a **system-wide** install — direct to the official installer.\n- Host `dotnet` is **older than v10** — `paths` doesn't exist; explain and stop.\n- User needs a **runtime-only** install — `paths` applies to SDK resolution only.\n\n## Inputs \u002F Prerequisites\n\n| Input | Required | Default | Notes |\n|---|---|---|---|\n| Channel or version | No | `11.0` | e.g. `11.0`, `STS`, `LTS`, or an exact version like `11.0.100-preview.2.26159.112` |\n| Quality | No | `preview` | One of: `daily`, `preview`, `ga` |\n| jq | No | — | Optional for bash team scripts when patching an existing `global.json`; without it, do not overwrite the file |\n\n### Prerequisites\n\n1. **A .NET 10+ SDK is installed globally** — run `dotnet --version`; major ≥ 10.\n2. **curl** (macOS\u002FLinux) or **PowerShell** (Windows) is available.\n\n## Workflow\n\n### Step 1 — Clarify what to install\n\nIf the user didn't specify, ask what .NET SDK version they want (e.g., \"latest\n.NET 11 preview\" or an exact version like `11.0.100-preview.2.26159.112`).\nMap the answer to `--channel`\u002F`--quality` or `--version` flags.\n\n### Step 2 — Verify .NET 10+ host\n\nIf the user already provided `dotnet --version` output, treat that as the\nauthoritative version for their machine. Do not override it with the agent\nworkspace's version; if the two differ, explain that the workspace differs and\ncontinue advising for the user's machine.\n\n```bash\ndotnet --version\n```\n\nIf major version \u003C 10, stop before downloading anything: the `paths` feature\nrequires a .NET 10+ host SDK. Tell the user to install .NET 10 or later\nsystem-wide first, then return to the local SDK setup.\n\n### Step 3 — Detect operating system\n\nRun `uname -s 2>\u002Fdev\u002Fnull`. If it succeeds (including `MINGW*`, `MSYS*`, `CYGWIN*` —\nthese are bash-capable environments like Git Bash) → use bash\u002F`dotnet-install.sh`.\nIf it fails (native Windows without Git Bash) → use PowerShell\u002F`dotnet-install.ps1`.\n\n### Step 4 — Check for existing local SDK\n\n**macOS \u002F Linux:**\n\n```bash\ntest -d .dotnet && echo \"exists\" || echo \"not found\"\n```\n\n**Windows (PowerShell):**\n\n```powershell\nif (Test-Path -LiteralPath .\\.dotnet) { \"exists\" } else { \"not found\" }\n```\n\nIf `.dotnet\u002F` exists, ask: update with the new version, or skip and keep it?\n\n### Step 5 — Download and run the install script\n\n**macOS \u002F Linux:**\n\n```bash\nINSTALL_SCRIPT=\"$(mktemp \"${TMPDIR:-\u002Ftmp}\u002Fdotnet-install.XXXXXX\")\"\ntrap 'rm -f \"$INSTALL_SCRIPT\"' EXIT\ncurl -fsSL https:\u002F\u002Fdot.net\u002Fv1\u002Fdotnet-install.sh -o \"$INSTALL_SCRIPT\"\nbash \"$INSTALL_SCRIPT\" --channel \u003CCHANNEL> --quality \u003CQUALITY> --install-dir .dotnet\n```\n\n**Windows (PowerShell):**\n\n```powershell\n$installScript = Join-Path $env:TEMP \"dotnet-install-$([guid]::NewGuid()).ps1\"\ntry {\n    Invoke-WebRequest -Uri 'https:\u002F\u002Fdot.net\u002Fv1\u002Fdotnet-install.ps1' -OutFile $installScript\n    & $installScript -Channel \u003CCHANNEL> -Quality \u003CQUALITY> -InstallDir .dotnet\n}\nfinally {\n    if (Test-Path -LiteralPath $installScript) {\n        Remove-Item -LiteralPath $installScript -Force\n    }\n}\n```\n\nFor exact versions: use `--version \u003CVERSION>` (bash) or `-Version \u003CVERSION>` (PowerShell)\ninstead of channel\u002Fquality flags. The install scripts are from Microsoft's official\nURLs: `https:\u002F\u002Fdot.net\u002Fv1\u002Fdotnet-install.sh` and `https:\u002F\u002Fdot.net\u002Fv1\u002Fdotnet-install.ps1`.\n\n### Step 6 — Identify the installed version\n\n```bash\n.\u002F.dotnet\u002Fdotnet --version          # macOS\u002FLinux\n.\\.dotnet\\dotnet.exe --version      # Windows\n```\n\nRecord the exact version string (e.g., `11.0.100-preview.2.26159.112`) for `global.json`.\n\n### Step 7 — Create or update global.json\n\n```json\n{\n  \"sdk\": {\n    \"version\": \"\u003CINSTALLED_VERSION>\",\n    \"allowPrerelease\": true,\n    \"rollForward\": \"latestFeature\",\n    \"paths\": [\".dotnet\", \"$host$\"],\n    \"errorMessage\": \"Required .NET SDK not found. Run .\u002Finstall-dotnet.sh (or .ps1) to install it locally.\"\n  }\n}\n```\n\n- `paths`: `.dotnet` first (local priority), `$host$` = system-wide fallback.\n- `rollForward: \"latestFeature\"`: use for latest-preview or floating feature-band installs.\n- Exact version requests: use `rollForward: \"disable\"` so SDK resolution doesn't move to a different feature band.\n- `allowPrerelease`: set to `true` only when installing a prerelease SDK. Omit for stable versions.\n- `errorMessage`: include only when team install scripts are created (Step 10). Otherwise omit.\n\nIf `global.json` already exists, **merge** carefully: preserve existing properties (`msbuild-sdks`,\n`tools`, etc.) and only add\u002Fupdate the `sdk` section. Read the existing file first, update\u002Fadd\nthe `sdk` object, then write it back. This ensures cross-project config (e.g., MSBuild settings)\nisn't lost. Always back up the original file (e.g., `global.json.bak`) before modifying.\n\n**Minimal config** (when version pinning isn't needed):\n`{\"sdk\":{\"paths\":[\".dotnet\",\"$host$\"]}}`\n\n### Step 8 — Update .gitignore\n\n**macOS \u002F Linux (or Git Bash):**\n\n```bash\ngrep -qxF '.dotnet\u002F' .gitignore 2>\u002Fdev\u002Fnull || printf '\\n.dotnet\u002F\\n' >> .gitignore\n```\n\n**Windows (PowerShell):**\n\n```powershell\nif (-not (Test-Path .gitignore) -or -not (Select-String -Path .gitignore -Pattern '^\\.dotnet\u002F$' -Quiet)) {\n    Add-Content -Path .gitignore -Value '.dotnet\u002F'\n}\n```\n\n### Step 9 — Install workloads (if requested)\n\nOnly do this after `global.json` and `.gitignore` are complete, so a slow or\nplatform-limited workload install does not prevent the base local SDK setup from\nbeing usable.\n\nIf the user mentioned MAUI, mobile, workload, Blazor WASM, or cross-platform,\ninstall using the **local** binary (no sudo needed):\n\n```bash\n.\u002F.dotnet\u002Fdotnet workload install \u003Cworkload>       # macOS\u002FLinux\n.\\.dotnet\\dotnet.exe workload install \u003Cworkload>   # Windows\n```\n\nVerify: `.\u002F.dotnet\u002Fdotnet workload list` (or `.\\.dotnet\\dotnet.exe workload list`).\n\nFor MAUI, pick a workload supported by the current OS and target platform. On\nLinux, the full `maui` meta-workload is not available; use a supported workload\nsuch as `maui-android` when Android is the target, or explain the platform\nlimitation and ask which target to configure.\n\n> **Always use the local dotnet binary for workload commands.** Workload metadata\n> is stored relative to the host process's dotnet root. The system `dotnet` puts\n> metadata in the wrong location. (See [dotnet\u002Fsdk#49825](https:\u002F\u002Fgithub.com\u002Fdotnet\u002Fsdk\u002Fissues\u002F49825).)\n\n### Step 10 — Create team install scripts\n\nCreate if user mentioned \"team\", \"share\", \"CI\", \"scripts\", etc. Otherwise offer.\nThese examples back up `global.json` and preserve existing settings. The bash script\nuses `jq` when an existing `global.json` must be patched; if `jq` is unavailable,\nit refuses to overwrite the file and prints the settings to merge manually.\nAdapt script variables to the install choice from Step 1: exact versions should\nuse `--version` \u002F `-Version` and `rollForward: \"disable\"`; channel installs should\nuse channel\u002Fquality and only set `allowPrerelease: true` for prerelease SDKs.\nIf `global.json` already pins `sdk.version` and the user mainly needs team\nscripts, reuse that version in the scripts and update `global.json` first; do\nnot start a long SDK download just to discover the version. When the user asks\nfor both setup and scripts, create the scripts\u002Fconfig before any long install so\nthe reproducible setup exists even if download or workload installation is slow.\n\n**install-dotnet.sh:**\n\n```bash\n#!\u002Fusr\u002Fbin\u002Fenv bash\nset -euo pipefail\nINSTALL_DIR=\".dotnet\"\nCHANNEL=\"11.0\"\nQUALITY=\"preview\"\nVERSION=\"\"\nROLL_FORWARD=\"latestFeature\"\nALLOW_PRERELEASE=\"true\"\nWORKLOADS=(\"${@}\")\nERROR_MESSAGE=\"Required .NET SDK not found. Run .\u002Finstall-dotnet.sh (or .ps1) to install it locally.\"\nINSTALL_SCRIPT=\"$(mktemp \"${TMPDIR:-\u002Ftmp}\u002Fdotnet-install.XXXXXX\")\"\nGLOBAL_JSON_TMP=\"\"\ncleanup() {\n    rm -f \"$INSTALL_SCRIPT\"\n    [ -n \"$GLOBAL_JSON_TMP\" ] && rm -f \"$GLOBAL_JSON_TMP\"\n}\ntrap cleanup EXIT\ncurl -fsSL https:\u002F\u002Fdot.net\u002Fv1\u002Fdotnet-install.sh -o \"$INSTALL_SCRIPT\"\nINSTALL_ARGS=(--install-dir \"$INSTALL_DIR\")\nif [ -n \"$VERSION\" ]; then\n    INSTALL_ARGS+=(--version \"$VERSION\")\n    ROLL_FORWARD=\"disable\"\nelse\n    INSTALL_ARGS+=(--channel \"$CHANNEL\" --quality \"$QUALITY\")\nfi\nbash \"$INSTALL_SCRIPT\" \"${INSTALL_ARGS[@]}\"\nSDK_VERSION=$(\"$INSTALL_DIR\u002Fdotnet\" --version)\nwrite_global_json() {\n    if [ -f global.json ]; then\n        cp global.json global.json.bak\n        if ! command -v jq >\u002Fdev\u002Fnull 2>&1; then\n            echo \"global.json exists; install succeeded, but this script will not overwrite it without jq.\" >&2\n            echo \"Merge these sdk settings manually so existing global.json properties are preserved:\" >&2\n            cat >&2 \u003C\u003CEOF\n{\n  \"sdk\": {\n    \"version\": \"$SDK_VERSION\",\n    \"allowPrerelease\": $ALLOW_PRERELEASE,\n    \"rollForward\": \"$ROLL_FORWARD\",\n    \"paths\": [\".dotnet\", \"\\$host\\$\"],\n    \"errorMessage\": \"$ERROR_MESSAGE\"\n  }\n}\nEOF\n            exit 1\n        fi\n        GLOBAL_JSON_TMP=\"$(mktemp \"${TMPDIR:-\u002Ftmp}\u002Fglobal-json.XXXXXX\")\"\n        jq --arg version \"$SDK_VERSION\" --arg rollForward \"$ROLL_FORWARD\" --argjson allowPrerelease \"$ALLOW_PRERELEASE\" --arg errorMessage \"$ERROR_MESSAGE\" '\n          .sdk = ((.sdk \u002F\u002F {}) + {\n            version: $version,\n            allowPrerelease: $allowPrerelease,\n            rollForward: $rollForward,\n            paths: [\".dotnet\", \"$host$\"],\n            errorMessage: $errorMessage\n          })\n        ' global.json > \"$GLOBAL_JSON_TMP\"\n        mv \"$GLOBAL_JSON_TMP\" global.json\n        GLOBAL_JSON_TMP=\"\"\n    else\n        cat > global.json \u003C\u003CEOF\n{\n  \"sdk\": {\n    \"version\": \"$SDK_VERSION\",\n    \"allowPrerelease\": $ALLOW_PRERELEASE,\n    \"rollForward\": \"$ROLL_FORWARD\",\n    \"paths\": [\".dotnet\", \"\\$host\\$\"],\n    \"errorMessage\": \"$ERROR_MESSAGE\"\n  }\n}\nEOF\n    fi\n}\nwrite_global_json\ngrep -qxF '.dotnet\u002F' .gitignore 2>\u002Fdev\u002Fnull || printf '\\n.dotnet\u002F\\n' >> .gitignore\n[ ${#WORKLOADS[@]} -gt 0 ] && \"$INSTALL_DIR\u002Fdotnet\" workload install \"${WORKLOADS[@]}\"\necho \"Done. SDK: $SDK_VERSION\"\n```\n\n```bash\nchmod +x install-dotnet.sh\n```\n\n**install-dotnet.ps1:**\n\n```powershell\nparam([string[]]$Workloads = @())\n$ErrorActionPreference = 'Stop'\n$installDir = '.dotnet'; $channel = '11.0'; $quality = 'preview'\n$version = ''; $rollForward = 'latestFeature'; $allowPrerelease = $true\n$errorMessage = 'Required .NET SDK not found. Run .\u002Finstall-dotnet.sh (or .ps1) to install it locally.'\n$installScript = Join-Path $env:TEMP \"dotnet-install-$([guid]::NewGuid()).ps1\"\ntry {\n    Invoke-WebRequest -Uri 'https:\u002F\u002Fdot.net\u002Fv1\u002Fdotnet-install.ps1' -OutFile $installScript\n    $installArgs = @('-InstallDir', $installDir)\n    if ($version) {\n        $installArgs += @('-Version', $version)\n        $rollForward = 'disable'\n    } else {\n        $installArgs += @('-Channel', $channel, '-Quality', $quality)\n    }\n    & $installScript @installArgs\n}\nfinally {\n    if (Test-Path -LiteralPath $installScript) {\n        Remove-Item -LiteralPath $installScript -Force\n    }\n}\n$sdkVersion = & \"$installDir\\dotnet.exe\" --version\n$globalJson = if (Test-Path 'global.json') {\n    Copy-Item 'global.json' 'global.json.bak'\n    Get-Content -Path 'global.json' -Raw | ConvertFrom-Json\n} else {\n    [pscustomobject]@{}\n}\nif (-not $globalJson.PSObject.Properties['sdk']) {\n    $globalJson | Add-Member -MemberType NoteProperty -Name 'sdk' -Value ([pscustomobject]@{})\n}\n$updates = [ordered]@{\n    version = $sdkVersion\n    allowPrerelease = $allowPrerelease\n    rollForward = $rollForward\n    paths = @('.dotnet', '$host$')\n    errorMessage = $errorMessage\n}\nforeach ($entry in $updates.GetEnumerator()) {\n    $property = $globalJson.sdk.PSObject.Properties[$entry.Key]\n    if ($property) {\n        $property.Value = $entry.Value\n    } else {\n        $globalJson.sdk | Add-Member -MemberType NoteProperty -Name $entry.Key -Value $entry.Value\n    }\n}\n$globalJson | ConvertTo-Json -Depth 10 | Set-Content -Path 'global.json' -Encoding UTF8\nif (-not (Test-Path .gitignore) -or -not (Select-String -Path .gitignore -Pattern '^\\.dotnet\u002F$' -Quiet)) {\n    Add-Content -Path .gitignore -Value '.dotnet\u002F'\n}\nif ($Workloads.Count -gt 0) { & \"$installDir\\dotnet.exe\" workload install @Workloads }\nWrite-Host \"Done. SDK: $sdkVersion\"\n```\n\nCommit these scripts to the repo so teammates can run them.\n\n### Step 11 — Verify SDK resolution\n\n```bash\ndotnet --version\n```\n\nOutput should match the locally installed version. If not, check: global.json\nlocation, `paths` array contents, host dotnet version ≥ 10.\n\n### Step 12 — Summarize and explain cleanup\n\nTell the user: SDK installed, global.json configured, .dotnet\u002F gitignored, system\ninstall untouched. Cleanup: delete `.dotnet\u002F`, remove `paths`\u002F`errorMessage` from\nglobal.json, optionally delete install scripts. Include the final `global.json`\n`sdk` values (or a short snippet) so the user can see the configured version,\n`paths`, and any `errorMessage`. If workloads were requested, include the local\n`dotnet workload install ...` command used and the workload verification result\nor the exact blocker if the workload could not be installed.\n\n## Common pitfalls\n\n| Pitfall | Cause | Fix |\n|---|---|---|\n| `paths` ignored | Host `dotnet` \u003C v10 | Install .NET 10+ system-wide |\n| Wrong SDK resolves | `global.json` in parent directory | Check for global.json up the tree |\n| Teammates get \"SDK not found\" | `.dotnet\u002F` gitignored, no install script run | Use `errorMessage` in global.json |\n| Workloads missing | Used system `dotnet` instead of local | Use `.\u002F.dotnet\u002Fdotnet workload install` |\n| `dotnet app.dll` wrong runtime | `paths` is SDK-only, not apphost | Use `dotnet run` or set `DOTNET_ROOT` |\n","# setup-local-sdk\n\n## Purpose\n\nGuide the user through installing a .NET SDK into a project-local `.dotnet\u002F`\ndirectory and wiring it up via the `global.json` `paths` feature (.NET 10+).\nThe examples use .NET 11, but this works with any version — prerelease or stable.\n\nThe result is a fully isolated SDK that:\n- Does **not** modify the system-wide .NET installation.\n- Is picked up automatically by `dotnet` commands from the project root.\n- Can be deleted to revert (`rm -rf .dotnet\u002F` or `Remove-Item -Recurse -Force .\\.dotnet`).\n\n## When NOT to use\n\n- User wants a **system-wide** install — direct to the official installer.\n- Host `dotnet` is **older than v10** — `paths` doesn't exist; explain and stop.\n- User needs a **runtime-only** install — `paths` applies to SDK resolution only.\n\n## Inputs \u002F Prerequisites\n\n| Input | Required | Default | Notes |\n|---|---|---|---|\n| Channel or version | No | `11.0` | e.g. `11.0`, `STS`, `LTS`, or an exact version like `11.0.100-preview.2.26159.112` |\n| Quality | No | `preview` | One of: `daily`, `preview`, `ga` |\n| jq | No | — | Optional for bash team scripts when patching an existing `global.json`; without it, do not overwrite the file |\n\n### Prerequisites\n\n1. **A .NET 10+ SDK is installed globally** — run `dotnet --version`; major ≥ 10.\n2. **curl** (macOS\u002FLinux) or **PowerShell** (Windows) is available.\n\n## Workflow\n\n### Step 1 — Clarify what to install\n\nIf the user didn't specify, ask what .NET SDK version they want (e.g., \"latest\n.NET 11 preview\" or an exact version like `11.0.100-preview.2.26159.112`).\nMap the answer to `--channel`\u002F`--quality` or `--version` flags.\n\n### Step 2 — Verify .NET 10+ host\n\nIf the user already provided `dotnet --version` output, treat that as the\nauthoritative version for their machine. Do not override it with the agent\nworkspace's version; if the two differ, explain that the workspace differs and\ncontinue advising for the user's machine.\n\n```bash\ndotnet --version\n```\n\nIf major version \u003C 10, stop before downloading anything: the `paths` feature\nrequires a .NET 10+ host SDK. Tell the user to install .NET 10 or later\nsystem-wide first, then return to the local SDK setup.\n\n### Step 3 — Detect operating system\n\nRun `uname -s 2>\u002Fdev\u002Fnull`. If it succeeds (including `MINGW*`, `MSYS*`, `CYGWIN*` —\nthese are bash-capable environments like Git Bash) → use bash\u002F`dotnet-install.sh`.\nIf it fails (native Windows without Git Bash) → use PowerShell\u002F`dotnet-install.ps1`.\n\n### Step 4 — Check for existing local SDK\n\n**macOS \u002F Linux:**\n\n```bash\ntest -d .dotnet && echo \"exists\" || echo \"not found\"\n```\n\n**Windows (PowerShell):**\n\n```powershell\nif (Test-Path -LiteralPath .\\.dotnet) { \"exists\" } else { \"not found\" }\n```\n\nIf `.dotnet\u002F` exists, ask: update with the new version, or skip and keep it?\n\n### Step 5 — Download and run the install script\n\n**macOS \u002F Linux:**\n\n```bash\nINSTALL_SCRIPT=\"$(mktemp \"${TMPDIR:-\u002Ftmp}\u002Fdotnet-install.XXXXXX\")\"\ntrap 'rm -f \"$INSTALL_SCRIPT\"' EXIT\ncurl -fsSL https:\u002F\u002Fdot.net\u002Fv1\u002Fdotnet-install.sh -o \"$INSTALL_SCRIPT\"\nbash \"$INSTALL_SCRIPT\" --channel \u003CCHANNEL> --quality \u003CQUALITY> --install-dir .dotnet\n```\n\n**Windows (PowerShell):**\n\n```powershell\n$installScript = Join-Path $env:TEMP \"dotnet-install-$([guid]::NewGuid()).ps1\"\ntry {\n    Invoke-WebRequest -Uri 'https:\u002F\u002Fdot.net\u002Fv1\u002Fdotnet-install.ps1' -OutFile $installScript\n    & $installScript -Channel \u003CCHANNEL> -Quality \u003CQUALITY> -InstallDir .dotnet\n}\nfinally {\n    if (Test-Path -LiteralPath $installScript) {\n        Remove-Item -LiteralPath $installScript -Force\n    }\n}\n```\n\nFor exact versions: use `--version \u003CVERSION>` (bash) or `-Version \u003CVERSION>` (PowerShell)\ninstead of channel\u002Fquality flags. The install scripts are from Microsoft's official\nURLs: `https:\u002F\u002Fdot.net\u002Fv1\u002Fdotnet-install.sh` and `https:\u002F\u002Fdot.net\u002Fv1\u002Fdotnet-install.ps1`.\n\n### Step 6 — Identify the installed version\n\n```bash\n.\u002F.dotnet\u002Fdotnet --version          # macOS\u002FLinux\n.\\.dotnet\\dotnet.exe --version      # Windows\n```\n\nRecord the exact version string (e.g., `11.0.100-preview.2.26159.112`) for `global.json`.\n\n### Step 7 — Create or update global.json\n\n```json\n{\n  \"sdk\": {\n    \"version\": \"\u003CINSTALLED_VERSION>\",\n    \"allowPrerelease\": true,\n    \"rollForward\": \"latestFeature\",\n    \"paths\": [\".dotnet\", \"$host$\"],\n    \"errorMessage\": \"Required .NET SDK not found. Run .\u002Finstall-dotnet.sh (or .ps1) to install it locally.\"\n  }\n}\n```\n\n- `paths`: `.dotnet` first (local priority), `$host$` = system-wide fallback.\n- `rollForward: \"latestFeature\"`: use for latest-preview or floating feature-band installs.\n- Exact version requests: use `rollForward: \"disable\"` so SDK resolution doesn't move to a different feature band.\n- `allowPrerelease`: set to `true` only when installing a prerelease SDK. Omit for stable versions.\n- `errorMessage`: include only when team install scripts are created (Step 10). Otherwise omit.\n\nIf `global.json` already exists, **merge** carefully: preserve existing properties (`msbuild-sdks`,\n`tools`, etc.) and only add\u002Fupdate the `sdk` section. Read the existing file first, update\u002Fadd\nthe `sdk` object, then write it back. This ensures cross-project config (e.g., MSBuild settings)\nisn't lost. Always back up the original file (e.g., `global.json.bak`) before modifying.\n\n**Minimal config** (when version pinning isn't needed):\n`{\"sdk\":{\"paths\":[\".dotnet\",\"$host$\"]}}`\n\n### Step 8 — Update .gitignore\n\n**macOS \u002F Linux (or Git Bash):**\n\n```bash\ngrep -qxF '.dotnet\u002F' .gitignore 2>\u002Fdev\u002Fnull || printf '\\n.dotnet\u002F\\n' >> .gitignore\n```\n\n**Windows (PowerShell):**\n\n```powershell\nif (-not (Test-Path .gitignore) -or -not (Select-String -Path .gitignore -Pattern '^\\.dotnet\u002F$' -Quiet)) {\n    Add-Content -Path .gitignore -Value '.dotnet\u002F'\n}\n```\n\n### Step 9 — Install workloads (if requested)\n\nOnly do this after `global.json` and `.gitignore` are complete, so a slow or\nplatform-limited workload install does not prevent the base local SDK setup from\nbeing usable.\n\nIf the user mentioned MAUI, mobile, workload, Blazor WASM, or cross-platform,\ninstall using the **local** binary (no sudo needed):\n\n```bash\n.\u002F.dotnet\u002Fdotnet workload install \u003Cworkload>       # macOS\u002FLinux\n.\\.dotnet\\dotnet.exe workload install \u003Cworkload>   # Windows\n```\n\nVerify: `.\u002F.dotnet\u002Fdotnet workload list` (or `.\\.dotnet\\dotnet.exe workload list`).\n\nFor MAUI, pick a workload supported by the current OS and target platform. On\nLinux, the full `maui` meta-workload is not available; use a supported workload\nsuch as `maui-android` when Android is the target, or explain the platform\nlimitation and ask which target to configure.\n\n> **Always use the local dotnet binary for workload commands.** Workload metadata\n> is stored relative to the host process's dotnet root. The system `dotnet` puts\n> metadata in the wrong location. (See [dotnet\u002Fsdk#49825](https:\u002F\u002Fgithub.com\u002Fdotnet\u002Fsdk\u002Fissues\u002F49825).)\n\n### Step 10 — Create team install scripts\n\nCreate if user mentioned \"team\", \"share\", \"CI\", \"scripts\", etc. Otherwise offer.\nThese examples back up `global.json` and preserve existing settings. The bash script\nuses `jq` when an existing `global.json` must be patched; if `jq` is unavailable,\nit refuses to overwrite the file and prints the settings to merge manually.\nAdapt script variables to the install choice from Step 1: exact versions should\nuse `--version` \u002F `-Version` and `rollForward: \"disable\"`; channel installs should\nuse channel\u002Fquality and only set `allowPrerelease: true` for prerelease SDKs.\nIf `global.json` already pins `sdk.version` and the user mainly needs team\nscripts, reuse that version in the scripts and update `global.json` first; do\nnot start a long SDK download just to discover the version. When the user asks\nfor both setup and scripts, create the scripts\u002Fconfig before any long install so\nthe reproducible setup exists even if download or workload installation is slow.\n\n**install-dotnet.sh:**\n\n```bash\n#!\u002Fusr\u002Fbin\u002Fenv bash\nset -euo pipefail\nINSTALL_DIR=\".dotnet\"\nCHANNEL=\"11.0\"\nQUALITY=\"preview\"\nVERSION=\"\"\nROLL_FORWARD=\"latestFeature\"\nALLOW_PRERELEASE=\"true\"\nWORKLOADS=(\"${@}\")\nERROR_MESSAGE=\"Required .NET SDK not found. Run .\u002Finstall-dotnet.sh (or .ps1) to install it locally.\"\nINSTALL_SCRIPT=\"$(mktemp \"${TMPDIR:-\u002Ftmp}\u002Fdotnet-install.XXXXXX\")\"\nGLOBAL_JSON_TMP=\"\"\ncleanup() {\n    rm -f \"$INSTALL_SCRIPT\"\n    [ -n \"$GLOBAL_JSON_TMP\" ] && rm -f \"$GLOBAL_JSON_TMP\"\n}\ntrap cleanup EXIT\ncurl -fsSL https:\u002F\u002Fdot.net\u002Fv1\u002Fdotnet-install.sh -o \"$INSTALL_SCRIPT\"\nINSTALL_ARGS=(--install-dir \"$INSTALL_DIR\")\nif [ -n \"$VERSION\" ]; then\n    INSTALL_ARGS+=(--version \"$VERSION\")\n    ROLL_FORWARD=\"disable\"\nelse\n    INSTALL_ARGS+=(--channel \"$CHANNEL\" --quality \"$QUALITY\")\nfi\nbash \"$INSTALL_SCRIPT\" \"${INSTALL_ARGS[@]}\"\nSDK_VERSION=$(\"$INSTALL_DIR\u002Fdotnet\" --version)\nwrite_global_json() {\n    if [ -f global.json ]; then\n        cp global.json global.json.bak\n        if ! command -v jq >\u002Fdev\u002Fnull 2>&1; then\n            echo \"global.json exists; install succeeded, but this script will not overwrite it without jq.\" >&2\n            echo \"Merge these sdk settings manually so existing global.json properties are preserved:\" >&2\n            cat >&2 \u003C\u003CEOF\n{\n  \"sdk\": {\n    \"version\": \"$SDK_VERSION\",\n    \"allowPrerelease\": $ALLOW_PRERELEASE,\n    \"rollForward\": \"$ROLL_FORWARD\",\n    \"paths\": [\".dotnet\", \"\\$host\\$\"],\n    \"errorMessage\": \"$ERROR_MESSAGE\"\n  }\n}\nEOF\n            exit 1\n        fi\n        GLOBAL_JSON_TMP=\"$(mktemp \"${TMPDIR:-\u002Ftmp}\u002Fglobal-json.XXXXXX\")\"\n        jq --arg version \"$SDK_VERSION\" --arg rollForward \"$ROLL_FORWARD\" --argjson allowPrerelease \"$ALLOW_PRERELEASE\" --arg errorMessage \"$ERROR_MESSAGE\" '\n          .sdk = ((.sdk \u002F\u002F {}) + {\n            version: $version,\n            allowPrerelease: $allowPrerelease,\n            rollForward: $rollForward,\n            paths: [\".dotnet\", \"$host$\"],\n            errorMessage: $errorMessage\n          })\n        ' global.json > \"$GLOBAL_JSON_TMP\"\n        mv \"$GLOBAL_JSON_TMP\" global.json\n        GLOBAL_JSON_TMP=\"\"\n    else\n        cat > global.json \u003C\u003CEOF\n{\n  \"sdk\": {\n    \"version\": \"$SDK_VERSION\",\n    \"allowPrerelease\": $ALLOW_PRERELEASE,\n    \"rollForward\": \"$ROLL_FORWARD\",\n    \"paths\": [\".dotnet\", \"\\$host\\$\"],\n    \"errorMessage\": \"$ERROR_MESSAGE\"\n  }\n}\nEOF\n    fi\n}\nwrite_global_json\ngrep -qxF '.dotnet\u002F' .gitignore 2>\u002Fdev\u002Fnull || printf '\\n.dotnet\u002F\\n' >> .gitignore\n[ ${#WORKLOADS[@]} -gt 0 ] && \"$INSTALL_DIR\u002Fdotnet\" workload install \"${WORKLOADS[@]}\"\necho \"Done. SDK: $SDK_VERSION\"\n```\n\n```bash\nchmod +x install-dotnet.sh\n```\n\n**install-dotnet.ps1:**\n\n```powershell\nparam([string[]]$Workloads = @())\n$ErrorActionPreference = 'Stop'\n$installDir = '.dotnet'; $channel = '11.0'; $quality = 'preview'\n$version = ''; $rollForward = 'latestFeature'; $allowPrerelease = $true\n$errorMessage = 'Required .NET SDK not found. Run .\u002Finstall-dotnet.sh (or .ps1) to install it locally.'\n$installScript = Join-Path $env:TEMP \"dotnet-install-$([guid]::NewGuid()).ps1\"\ntry {\n    Invoke-WebRequest -Uri 'https:\u002F\u002Fdot.net\u002Fv1\u002Fdotnet-install.ps1' -OutFile $installScript\n    $installArgs = @('-InstallDir', $installDir)\n    if ($version) {\n        $installArgs += @('-Version', $version)\n        $rollForward = 'disable'\n    } else {\n        $installArgs += @('-Channel', $channel, '-Quality', $quality)\n    }\n    & $installScript @installArgs\n}\nfinally {\n    if (Test-Path -LiteralPath $installScript) {\n        Remove-Item -LiteralPath $installScript -Force\n    }\n}\n$sdkVersion = & \"$installDir\\dotnet.exe\" --version\n$globalJson = if (Test-Path 'global.json') {\n    Copy-Item 'global.json' 'global.json.bak'\n    Get-Content -Path 'global.json' -Raw | ConvertFrom-Json\n} else {\n    [pscustomobject]@{}\n}\nif (-not $globalJson.PSObject.Properties['sdk']) {\n    $globalJson | Add-Member -MemberType NoteProperty -Name 'sdk' -Value ([pscustomobject]@{})\n}\n$updates = [ordered]@{\n    version = $sdkVersion\n    allowPrerelease = $allowPrerelease\n    rollForward = $rollForward\n    paths = @('.dotnet', '$host$')\n    errorMessage = $errorMessage\n}\nforeach ($entry in $updates.GetEnumerator()) {\n    $property = $globalJson.sdk.PSObject.Properties[$entry.Key]\n    if ($property) {\n        $property.Value = $entry.Value\n    } else {\n        $globalJson.sdk | Add-Member -MemberType NoteProperty -Name $entry.Key -Value $entry.Value\n    }\n}\n$globalJson | ConvertTo-Json -Depth 10 | Set-Content -Path 'global.json' -Encoding UTF8\nif (-not (Test-Path .gitignore) -or -not (Select-String -Path .gitignore -Pattern '^\\.dotnet\u002F$' -Quiet)) {\n    Add-Content -Path .gitignore -Value '.dotnet\u002F'\n}\nif ($Workloads.Count -gt 0) { & \"$installDir\\dotnet.exe\" workload install @Workloads }\nWrite-Host \"Done. SDK: $sdkVersion\"\n```\n\nCommit these scripts to the repo so teammates can run them.\n\n### Step 11 — Verify SDK resolution\n\n```bash\ndotnet --version\n```\n\nOutput should match the locally installed version. If not, check: global.json\nlocation, `paths` array contents, host dotnet version ≥ 10.\n\n### Step 12 — Summarize and explain cleanup\n\nTell the user: SDK installed, global.json configured, .dotnet\u002F gitignored, system\ninstall untouched. Cleanup: delete `.dotnet\u002F`, remove `paths`\u002F`errorMessage` from\nglobal.json, optionally delete install scripts. Include the final `global.json`\n`sdk` values (or a short snippet) so the user can see the configured version,\n`paths`, and any `errorMessage`. If workloads were requested, include the local\n`dotnet workload install ...` command used and the workload verification result\nor the exact blocker if the workload could not be installed.\n\n## Common pitfalls\n\n| Pitfall | Cause | Fix |\n|---|---|---|\n| `paths` ignored | Host `dotnet` \u003C v10 | Install .NET 10+ system-wide |\n| Wrong SDK resolves | `global.json` in parent directory | Check for global.json up the tree |\n| Teammates get \"SDK not found\" | `.dotnet\u002F` gitignored, no install script run | Use `errorMessage` in global.json |\n| Workloads missing | Used system `dotnet` instead of local | Use `.\u002F.dotnet\u002Fdotnet workload install` |\n| `dotnet app.dll` wrong runtime | `paths` is SDK-only, not apphost | Use `dotnet run` or set `DOTNET_ROOT` |\n",{"name":5,"license":15,"description":7},"main","30954af1dcd1a74b63f05deb2e2c41e5ecae4a82","02-CSharp-WPF-Desktop-Development\u002Fsetup-local-sdk","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack","https:\u002F\u002Fgithub.com\u002Fitsmejay18","2026-09-18 16:06:36",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill setup-local-sdk",{"tool":36,"command":37},"bunx","bunx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill setup-local-sdk",{"tool":39,"command":40},"pnpm","pnpm dlx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill setup-local-sdk","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F02-CSharp-WPF-Desktop-Development\u002Fsetup-local-sdk\u002FSKILL.md",true,[],[45,52,59,66,73,80],{"skillNo":46,"name":47,"nameZh":6,"description":48,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":19},"01M7D2RKBHPZ3E1RNN5DWHT550","vectorization","Design, implement, optimize, and review SIMD code in .NET. USE FOR: vectorizing scalar loops with TensorPrimitives, Vector64\u002F128\u002F256\u002F512, or platform hardware intrinsics; reviewing existing SIMD code, including Vector\u003CT>, for contract equivalence, tail handling, memory safety, portability, fallbacks, and measured performance. DO NOT USE FOR: performance work unrelated to SIMD or vectorization.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fvectorization\u002FSKILL.md",[],[],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":19},"01M7D2RDJ7RN3QK8GJR0QTER1D","resolve-project-references","Guide for interpreting ResolveProjectReferences time in MSBuild performance summaries. Activate when ResolveProjectReferences appears as the most expensive target and developers are trying to optimize it directly. Explains that the reported time includes wait time for dependent project builds and is misleading. Guides users to focus on task self-time instead. Do not activate for general build performance -- use build-perf-diagnostics instead.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fresolve-project-references\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M7D2R1H2GTNZYHG9YRX3JDQW","optimizing-ef-core-queries","Optimize and improve the performance of slow Entity Framework Core (EF Core) queries: make them generate less SQL, make fewer database round-trips, and return results faster. Use whenever an EF Core or DbContext query or data-access path is slow or should be made faster — whether or not EF Core owns the database schema. For EF Core, not Dapper or raw ADO.NET.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Foptimizing-ef-core-queries\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M7D2QREG04W1YT0NEBHEW5C9","microbenchmarking","Activate this skill when BenchmarkDotNet (BDN) is involved in the task — creating, running, configuring, or reviewing BDN benchmarks. Also activate when microbenchmarking .NET code would be useful and BenchmarkDotNet is the likely tool. Consider activating when answering a .NET performance question requires measurement and BenchmarkDotNet may be needed. Covers microbenchmark design, BDN configuration and project setup, how to run BDN microbenchmarks efficiently and effectively, and using BDN for side-by-side performance comparisons. Do NOT use for profiling\u002Ftracing .NET code (dotnet-trace, PerfView), production telemetry, or load\u002Fstress testing (Crank, k6).","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fmicrobenchmarking\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M7D2QGE175XWPZVACVH2868Z","incremental-build","Guide for optimizing MSBuild incremental builds. USE FOR: builds slower than expected on subsequent runs, 'nothing changed but it rebuilds anyway', diagnosing why targets re-execute unnecessarily, fixing broken no-op builds. Covers 8 common causes: missing Inputs\u002FOutputs on custom targets, volatile properties in output paths (timestamps\u002FGUIDs), file writes outside tracked Outputs, missing FileWrites registration, glob changes, Visual Studio Fast Up-to-Date Check (FUTDC) issues. Key diagnostic: look for 'Building target completely' vs 'Skipping target' in binlog. DO NOT USE FOR: first-time build slowness (use build-perf-baseline), parallelism issues (use build-parallelism), evaluation-phase slowness (use eval-performance), non-MSBuild build systems.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fincremental-build\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7D2Q1DQTC6K49R73WQTTPSB","eval-performance","Guide for diagnosing and improving MSBuild project evaluation performance. USE FOR: builds slow before any compilation starts, high evaluation time in binlog analysis, expensive glob patterns walking large directories (node_modules, .git, bin\u002Fobj), deep import chains (>20 levels), preprocessed output >10K lines indicating heavy evaluation, property functions with file I\u002FO ($([System.IO.File]::ReadAllText(...))), multiple evaluations per project. Covers the 5 MSBuild evaluation phases, glob optimization via DefaultItemExcludes, import chain analysis with \u002Fpp preprocessing. DO NOT USE FOR: compilation-time slowness (use build-perf-diagnostics), incremental build issues (use incremental-build), non-MSBuild build systems.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Feval-performance\u002FSKILL.md",[],[]]