switcher
Switch .csproj references between NuGet packages and local projects using a JSON config
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Switch .csproj references between NuGet packages and local projects using a JSON config
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | switcher |
| description | Switch .csproj references between NuGet packages and local projects using a JSON config |
Switch .csproj references between NuGet PackageReference and local ProjectReference entries using a switcher.json configuration file. Useful when developing across multiple .NET solutions that depend on each other.
When the user asks to switch references between NuGet packages and local projects, run the following command:
dotnet run "${CLAUDE_SKILL_DIR}/switcher.cs" <to-project|to-nuget|status> <path-to-switcher.json>
${CLAUDE_SKILL_DIR} resolves to this skill's directory regardless of where it's installed. Replace <to-project|to-nuget|status> with the desired command and <path-to-switcher.json> with the path to the configuration file.
The switcher.json file defines which references can be switched and which .csproj targets to modify. All paths are relative to the config file's directory.
{
"references": [
{
"package": "Acme.Core",
"version": "2.1.0",
"project": "../acme-core/src/Acme.Core/Acme.Core.csproj"
}
],
"targets": [
"src/MyApp/MyApp.csproj"
]
}
references[].package — NuGet package name (matches <PackageReference Include="...">).references[].version — Version to restore when switching back to NuGet.references[].project — Path to the local .csproj for ProjectReference.targets[] — .csproj files to modify.| Command | Action |
|---|---|
to-project | Replace matching PackageReference entries with ProjectReference pointing at local source |
to-nuget | Replace matching ProjectReference entries with PackageReference (restores version and extra attributes) |
status | Report current state of each reference in each target — no file changes |
[OK] src/MyApp/MyApp.csproj :: Acme.Core → ProjectReference
[SKIP] src/MyApp/MyApp.csproj :: Acme.Logging (already switched)
[NUGET] src/MyApp/MyApp.csproj :: Acme.Core (v2.1.0)
[PROJECT] src/MyApp/MyApp.csproj :: Acme.Core (../acme-core/src/Acme.Core/Acme.Core.csproj)
Done. Switched: 1 | Skipped: 1 | Errors: 0
.csproj editing.dotnet available on the PATH.System.Text.Json and System.Xml.Linq.switcher.json config file describing the references and targets.switcher.json — unlisted references are not touched.Directory.Build.props or Directory.Packages.props (central package management).PackageReference (e.g. PrivateAssets, IncludeAssets) are preserved via XML comments and restored on round-trip, but only when the switch was performed by this tool.