package-management

Manage NuGet packages and Central Package Management for .NET solutions using dotnet CLI.

Updated Mar 8, 2026
One-click install
npx skills add https://github.com/AGIBuild/dotnet.CI.template --skill package-management-agibuild
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: package-management
Source: https://github.com/AGIBuild/dotnet.CI.template/tree/main/.cursor/skills/package-management
Command: npx skills add https://github.com/AGIBuild/dotnet.CI.template --skill package-management-agibuild

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Managing NuGet packages across multi-project .NET solutions often leads to version conflicts, inconsistent dependency versions, and error-prone manual XML edits. This Skill provides CLI-first workflows and Central Package Management patterns to keep dependencies consistent and auditable. ## Core Features & Use Cases - CLI-First Package Operations: Add, remove, list, and update packages using dotnet CLI commands instead of editing .csproj XML directly. - Central Package Management (CPM): Set up Directory.Packages.props with shared version variables so related packages like Akka.NET or Aspire stay on synchronized versions. - Troubleshooting & Governance: Diagnose version conflicts, restore failures, and vulnerable or deprecated packages, with guidance on lock files and private feeds. - Use Case: When adding Serilog to a solution with CPM enabled, run dotnet add package Serilog so the version lands in Directory.Packages.props and the reference lands in the project file automatically. ## Quick Start Ask the assistant to add a specific NuGet package to your .NET project using Central Package Management and the dotnet CLI.

Frequently Asked Questions about package-management

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a NuGet package to a .NET project?▼

Use dotnet add package <name> from the CLI, optionally with --version for a specific release or --prerelease for pre-release builds. The CLI validates the package exists, resolves the correct version, and updates project files and lock files automatically.

How to set up Central Package Management in a .NET solution?▼

Create a Directory.Packages.props file in the solution root with ManagePackageVersionsCentrally set to true and PackageVersion entries for each dependency. Project files then reference packages without versions, and dotnet add package updates both files.

When should I not use Central Package Management?▼

Avoid CPM for legacy solutions with intentional version differences, when you need version ranges (CPM requires exact versions), or when tooling is older than .NET SDK 6.0.300 and NuGet 6.2. Multi-repo solutions also need separate props files per repository.

How do I find outdated or vulnerable NuGet packages?▼

Run dotnet list package --outdated to see available updates, --vulnerable for known security issues, and --deprecated for deprecated packages. Add --include-transitive to inspect the full dependency tree.

Why does NuGet restore fail and how do I fix it?▼

Restore failures often come from stale caches or version conflicts. Clear caches with dotnet nuget locals all --clear, then run dotnet restore --force or --verbosity detailed to diagnose. Check packages.lock.json if lock files are enabled.