package-management

Manage .NET NuGet packages with Central Package Management and the dotnet CLI.

Updated Dec 4, 2022
One-click install
npx skills add https://github.com/devingoble/CloudOStat --skill package-management-devingoble
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: package-management
Source: https://github.com/devingoble/CloudOStat/tree/main/.github/skills/package-management
Command: npx skills add https://github.com/devingoble/CloudOStat --skill package-management-devingoble

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill streamlines the management of NuGet packages in .NET projects, preventing version conflicts and simplifying package updates.

Core Features & Use Cases

  • Central Package Management (CPM): Centralize package versions in Directory.Packages.props.
  • CLI-driven Operations: Use dotnet add, dotnet remove, dotnet list commands exclusively.
  • Shared Version Variables: Define and reuse version numbers for related packages.
  • Use Case: Quickly add a new logging library to all projects in your solution using a single command, ensuring consistent versioning.

Quick Start

Use the package-management skill to add the 'Newtonsoft.Json' package to your project.

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 packages across multiple projects without version conflicts?

Central Package Management (CPM) centralizes NuGet package versions in a Directory.Packages.props file to prevent version conflicts. It streamlines package updates and ensures consistent versioning across all projects within a .NET solution.

What is the best way to add a NuGet package to all projects in a .NET solution?

Using the dotnet CLI with Central Package Management is the best way to add a NuGet package solution-wide. You execute dotnet add package commands to apply shared version variables, ensuring every project references the same library version.

How does Central Package Management work with the dotnet CLI?

Central Package Management works with the dotnet CLI by using standard commands like dotnet add, dotnet remove, and dotnet list to manage packages. Version definitions are stored centrally in Directory.Packages.props rather than in individual project files.

Can I use shared version variables for related NuGet packages in .NET?

Yes, you can define and reuse shared version variables for related NuGet packages within your Directory.Packages.props file. This ensures that dependent libraries are updated together automatically, maintaining compatibility across your .NET solution.

Why are my dotnet add package commands not updating versions across projects?

If dotnet add package commands are not updating versions correctly, you may be missing CPM best practices or encountering troubleshooting issues with Directory.Packages.props. Ensure your solution is properly configured to use Central Package Management for versioning.

Do I need Central Package Management to list and remove NuGet packages efficiently?

While not strictly required, using Central Package Management with the dotnet list and dotnet remove commands significantly improves efficiency. It allows you to audit and remove dependencies across solution projects from a centralized configuration.