im5tu/dotnet-skills · Archived

dotnet-centralise-packages

Converts a .NET solution to use Central Package Management (CPM). Use when the user wants to centralize, consolidate, or unify NuGet package versions across projects.

First seen Feb 4, 2026

Installation

$ npx skills add im5tu/dotnet-skills --skill dotnet-centralise-packages

Stronger alternatives

This repository is archived — consider an actively maintained alternative.

Also in this package

Other skills from im5tu/dotnet-skills.

npx skills add im5tu/dotnet-skills

Browse all from im5tu/dotnet-skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 1
License MIT
Default branch main
Open issues 0
Status Archived

Skill metadata

Parsed from SKILL.md frontmatter.

Version1.0
LicenseMIT
Allowed toolsBash(dotnet:*) Read Glob AskUserQuestion
More metadata
author
Im5tu
version
1.0
repositoryUrl
https://github.com/im5tu/dotnet-skills

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 3,296 B
  • docs SUMMARY.md 200 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 3 installs

SKILL.md

Convert the current .NET solution to use Central Package Management, centralizing all package versions in a single Directory.Packages.props file.

Steps

  1. Find the solution file (*.sln) in the current directory

- If no .sln found, warn and stop

  1. List all packages (including transitive)

``bash dotnet package list --include-transitive --format json ``

  1. Parse JSON output to extract:

- All unique packages across all projects - Their versions - Whether each package is direct or transitive - If same package has different versions, use the highest version

  1. Check for existing CPM files

- If Directory.Packages.props exists, ask user: overwrite or merge - Note existing Directory.Build.props content if present

  1. Create Directory.Packages.props next to the .sln file:

``xml <Project> <ItemGroup> <PackageVersion Include="PackageName" Version="X.Y.Z" /> <!-- one entry per unique package --> </ItemGroup> </Project> ``

  1. Create or update Directory.Build.props next to the .sln file:

- If file exists, add the property to existing content - If file doesn't exist, create it: ``xml <Project> <PropertyGroup> <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> </PropertyGroup> </Project> ``

  1. Update all .csproj files:

- Remove Version attribute from all <PackageReference> elements - Before: <PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> - After: <PackageReference Include="Newtonsoft.Json" />

  1. Run build to verify:

``bash dotnet build ``

  1. If build fails, ask the user:

- Fix automatically: Review errors and attempt fixes - Fix manually: Show errors and let user handle

  1. Report results:

- List all created/modified files - Show package count centralized - Confirm build status

Transitive vs Direct Packages

  • Direct packages: Explicitly in csproj via <PackageReference>. These get centralized.
  • Transitive packages: Pulled in as dependencies. Generally NOT centralized unless:

- User explicitly wants to pin a transitive package version - A transitive package needs a security update

When centralizing:

  • Only add direct packages to Directory.Packages.props by default
  • Report transitive packages separately for awareness
  • If user wants to pin a transitive, add it as a <PackageVersion> entry

Version Conflict Resolution

When the same package has different versions across projects:

  • Automatically use the highest/latest version
  • No user prompt needed

Error Handling

  • If no .sln found: warn about solution-level CPM requirement
  • If Directory.Packages.props already exists: ask to overwrite or merge
  • If build fails after conversion: offer automatic fix or manual intervention