-
Verify Version Existence:
Check if the version exists using the dotnet package search command with exact match and JSON formatting.
Using jq:
dotnet package search <PACKAGE_NAME> --exact-match --format json | jq -e '.searchResult[].packages[] | select(.version == "<VERSION>")'
Using PowerShell:
(dotnet package search <PACKAGE_NAME> --exact-match --format json | ConvertFrom-Json).searchResult.packages | Where-Object { $_.version -eq "<VERSION>" }
-
Determine Version Management:
- 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" />.
- If absent, check individual
.csproj files for <PackageReference Include="Package.Name" Version="1.2.3" />.
-
Apply Changes:
Modify the identified file with the new version string.
-
Verify Stability:
Run dotnet restore on the project or solution. If errors occur, revert the change and investigate.