package-management

Manage NuGet packages across .NET solutions using dotnet CLI and CPM.

Updated Jan 29, 2024
One-click install
npx skills add https://github.com/riandeoliveira/aspnet-template --skill package-management-riandeoliveira
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: package-management
Source: https://github.com/riandeoliveira/aspnet-template/tree/main/.claude/skills/package-management
Command: npx skills add https://github.com/riandeoliveira/aspnet-template --skill package-management-riandeoliveira

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you add, remove, update, and diagnose NuGet dependencies in .NET solutions without version mismatches and fragile, error-prone manual XML edits.

Core Features & Use Cases

  • Central Package Management (CPM) guidance: Set up Directory.Packages.props to centralize versions across many projects, reducing conflicts.
  • Safe CLI-first workflows: Use dotnet commands to manage packages reliably, instead of editing .csproj or CPM props by hand.
  • Troubleshooting and operational commands: Find outdated, vulnerable, deprecated, and transitive dependencies; clear caches and restore to resolve restore issues.
  • Use Case: You need to align versions for related libraries (e.g., logging, telemetry, testing) across multiple projects in a solution and keep them in sync during upgrades.

Quick Start

Enable Central Package Management by running a package command such as "dotnet add package Serilog.Sinks.Console" and then ensure versions are maintained in Directory.Packages.props via CPM.

Frequently Asked Questions about package-management

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

FAQPage Schema
How do I manage NuGet package versions across multiple projects without conflicts?

Central Package Management (CPM) centralizes NuGet package versions across multiple .NET projects using a `Directory.Packages.props` file, preventing version conflicts. It eliminates fragile manual XML edits by enforcing consistent version declarations for shared libraries across your entire solution.

What is the best way to update NuGet dependencies in a .NET solution using CPM?

The best way to update NuGet dependencies in CPM is using safe CLI-first workflows with `dotnet` commands. Run commands like `dotnet add package` to modify dependencies reliably, ensuring versions are maintained in `Directory.Packages.props` instead of editing `.csproj` files manually.

How can I find vulnerable or outdated transitive NuGet dependencies?

You can find vulnerable, outdated, deprecated, and transitive NuGet dependencies using built-in CLI-based diagnostic commands. The `dotnet` CLI provides operational commands to audit your package state, helping you identify and resolve security risks and transitive dependency issues during package restore.

Does Central Package Management require editing .csproj files for package updates?

No, Central Package Management avoids editing `.csproj` files entirely. It requires using `dotnet` CLI commands to add, remove, and update packages, while version declarations are centralized and maintained automatically in the `Directory.Packages.props` file.

Why does my NuGet package restore fail with version mismatches in my .NET solution?

NuGet package restore often fails due to version mismatches across multiple projects. Using Central Package Management with `dotnet` CLI workflows aligns versions for related libraries, and provides operational commands to clear caches and restore packages to resolve restore issues.

When do I need Central Package Management for my .NET solution?

You need Central Package Management when aligning versions for related libraries, such as logging or testing, across multiple projects in a .NET solution. It is applicable when adding, updating, listing, and troubleshooting packages to keep them in sync during upgrades.