Power Nuget Manager
Production-ready command that handles manage, nuget, packages, projects. Includes structured workflows, validation checks, and reusable patterns for project management.
Power NuGet Manager
Manage NuGet packages across .NET solutions using the dotnet CLI with enforced verification, version safety, and automatic restore workflows.
When to Use This Command
Run this command when...
- You need to add, remove, or update NuGet packages across one or more .NET projects in a solution
- You want to verify that a specific package version exists on NuGet.org before applying changes
- You must update a package version in centralized
Directory.Packages.propsor per-project.csprojfiles safely - You need a consistent workflow that prevents direct file edits for add/remove operations
- You want automatic
dotnet restorevalidation after every version change to catch compatibility issues early
Quick Start
# .claude/commands/power-nuget-manager.yaml name: Power NuGet Manager description: Safely manage NuGet packages with verification and restore inputs: - name: action description: "add, remove, or update" - name: package description: "NuGet package name" - name: version description: "Target version (for update)" default: ""
# Add a package to a specific project claude "power-nuget-manager add Serilog --project src/WebApi/WebApi.csproj" # Update a package version across the solution claude "power-nuget-manager update Newtonsoft.Json --version 13.0.3"
Output:
[verify] Checking NuGet for [email protected]... found
[locate] Version managed in Directory.Packages.props
[update] Updated Newtonsoft.Json 12.0.3 -> 13.0.3
[restore] Running dotnet restore... success
Done. 1 package updated, 0 errors.
Core Concepts
| Concept | Description |
|---|---|
| CLI-First Rule | Always use dotnet add/remove package for additions and removals; never edit project files directly |
| Version Verification | Every version update begins by confirming the version exists on NuGet.org via dotnet package search |
| Centralized Management | Detects Directory.Packages.props for solution-wide version control vs per-project .csproj files |
| Restore Validation | Runs dotnet restore immediately after every change to catch dependency conflicts |
| Safe Rollback | Reverts changes automatically if dotnet restore fails after a version update |
Workflow:
ββββββββββββββββ βββββββββββββββββ ββββββββββββββββ
β Verify NuGet ββββ>β Locate Config ββββ>β Apply Change β
ββββββββββββββββ βββββββββββββββββ ββββββββ¬ββββββββ
β
ββββββββΌββββββββ
β dotnet restoreβ
ββββββββ¬ββββββββ
pass/ β \fail
ββββββ β ββββββββ
βDoneβ β βRevertβ
ββββββ β ββββββββ
Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
action | string | required | Operation: add, remove, or update |
package | string | required | NuGet package name (e.g., Newtonsoft.Json) |
version | string | latest | Target version for add or update operations |
project | string | solution | Specific .csproj path or entire solution |
verify | boolean | true | Check NuGet.org before applying version changes |
Best Practices
- Always verify before updating -- Let the command confirm the version exists on NuGet.org rather than guessing version numbers. This prevents broken restores and wasted debugging time.
- Prefer centralized version management -- Use
Directory.Packages.propsfor solutions with multiple projects to keep all package versions in sync and avoid version drift. - Run on the full solution -- When updating shared packages, target the solution root so that all projects receive the change and
dotnet restorevalidates cross-project compatibility. - Review restore output carefully -- A successful restore does not guarantee runtime compatibility. Check for binding redirect warnings and framework version conflicts in the output.
- Commit after each package change -- Make atomic commits per package operation so that rollbacks are clean and git bisect remains effective for tracking regressions.
Common Issues
- Version not found on NuGet -- The specified version does not exist or is unlisted. Run
dotnet package search <name> --exact-matchmanually to see available versions. Check for prerelease versions with--prereleaseflag. - Restore fails after update -- The new version has incompatible dependencies with other packages in the solution. Revert the change, then check the dependency graph with
dotnet list package --include-transitiveto find conflicts. - Wrong file edited for version -- The command updated
.csprojbut the solution usesDirectory.Packages.props, or vice versa. Verify which management strategy is in place by checking the solution root forDirectory.Packages.propsbefore running updates.
Reviews
No reviews yet. Be the first to review this template!
Similar Templates
Git Commit Message Generator
Generates well-structured conventional commit messages by analyzing staged changes. Follows Conventional Commits spec with scope detection.
React Component Scaffolder
Scaffolds a complete React component with TypeScript types, Tailwind styles, Storybook stories, and unit tests. Follows project conventions automatically.
CI/CD Pipeline Generator
Generates GitHub Actions workflows for CI/CD including linting, testing, building, and deploying. Detects project stack automatically.