package-management
Agent skill fromAaronontheweb/dotnet-skills
Manage NuGet packages using Central Package Management (CPM) and dotnet CLI commands. Never edit XML directly - use dotnet add/remove/list commands. Use shared version variables for related packages.
How to install package-management
install package-management
# install the dotnet-skills pack with the skills CLI
npx skills add Aaronontheweb/dotnet-skills# or add only this skill to Claude Code: copy the folder
skills/package-management/
# into
~/.claude/skills/package-management/ (all projects)
.claude/skills/package-management/ (one project)
1# NuGet Package Management23## When to Use This Skill45Use this skill when:6- Adding, removing, or updating NuGet packages7- Setting up Central Package Management (CPM) for a solution8- Managing package versions across multiple projects9- Troubleshooting package conflicts or restore issues1011---1213## Golden Rule: Never Edit XML Directly1415**Always use `dotnet` CLI commands to manage packages.** Never manually edit `.csproj` or `Directory.Packages.props` files.1617```bash18# DO: Use CLI commands19dotnet add package Newtonsoft.Json20dotnet remove package Newtonsoft.Json21dotnet list package --outdated2223# DON'T: Edit XML directly24# <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />25```2627**Why:**28- CLI validates package exists and resolves correct version29- Handles transitive dependencies correctly30- Updates lock files if present31- Avoids typos and malformed XML32- Works correctly with CPM3334---3536## Central Package Management (CPM)3738CPM centralizes all package versions in one file, eliminating version conflicts across projects.3940### Enable CPM4142Create `Directory.Packages.props` in solution root:4344```xml45<Project>46 <PropertyGroup>47 <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>48 </PropertyGroup>4950 <ItemGroup>51 <PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />52 <PackageVersion Include="Serilog" Version="4.0.0" />53 <PackageVersion Include="xunit" Version="2.9.2" />54 </ItemGroup>55</Project>56```5758### Project Files with CPM59…
Excerpt shown under the repository's MIT license.
