Skip to content

Commit 6e801aa

Browse files
committed
Address PR feedback
1 parent 8d0adc6 commit 6e801aa

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

skills/nuget-manager/SKILL.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ description: 'Manage NuGet packages in .NET projects/solutions. Use this skill w
99

1010
This skill ensures consistent and safe management of NuGet packages across .NET projects. It prioritizes using the `dotnet` CLI to maintain project integrity and enforces a strict verification and restoration workflow for version updates.
1111

12+
## Prerequisites
13+
14+
- .NET SDK installed (typically .NET 8.0 SDK or later, or a version compatible with the target solution).
15+
- `dotnet` CLI available on your `PATH`.
16+
- `jq` (JSON processor) OR PowerShell (for version verification using `dotnet package search`).
17+
1218
## Core Rules
1319

1420
1. **NEVER** directly edit `.csproj`, `.props`, or `Directory.Packages.props` files to **add** or **remove** packages. Always use `dotnet add package` and `dotnet remove package` commands.
@@ -33,8 +39,11 @@ Example: `dotnet remove src/MyProject/MyProject.csproj package Newtonsoft.Json`
3339
When updating a version, follow these steps:
3440

3541
1. **Verify Version Existence**:
36-
Check if the version exists using the `dotnet package search` command with exact match and JSON formatting:
42+
Check if the version exists using the `dotnet package search` command with exact match and JSON formatting.
43+
Using `jq`:
3744
`dotnet package search <PACKAGE_NAME> --exact-match --format json | jq -e '.searchResult[].packages[] | select(.version == "<VERSION>")'`
45+
Using PowerShell:
46+
`(dotnet package search <PACKAGE_NAME> --exact-match --format json | ConvertFrom-Json).searchResult.packages | Where-Object { $_.version -eq "<VERSION>" }`
3847

3948
2. **Determine Version Management**:
4049
- Search for `Directory.Packages.props` in the solution root. If present, versions should be managed there via `<PackageVersion Include="Package.Name" Version="1.2.3" />`.
@@ -53,7 +62,7 @@ When updating a version, follow these steps:
5362

5463
### User: "Update Newtonsoft.Json to 13.0.3 in the whole solution"
5564
**Action**:
56-
1. Verify 13.0.3 exists: `dotnet package search Newtonsoft.Json --exact-match --format json | jq -e '.searchResult[].packages[] | select(.version == "13.0.3")'`
65+
1. Verify 13.0.3 exists: `dotnet package search Newtonsoft.Json --exact-match --format json` (and parse output to confirm "13.0.3" is present).
5766
2. Find where it's defined (e.g., `Directory.Packages.props`).
5867
3. Edit the file to update the version.
5968
4. Run `dotnet restore`.

0 commit comments

Comments
 (0)