Skip to content

Preserve version ranges when upgrading packages#702

Open
GREsau wants to merge 3 commits into
dotnet-outdated:masterfrom
GREsau:version-range
Open

Preserve version ranges when upgrading packages#702
GREsau wants to merge 3 commits into
dotnet-outdated:masterfrom
GREsau:version-range

Conversation

@GREsau

@GREsau GREsau commented Feb 11, 2026

Copy link
Copy Markdown

Fixes #388

This PR changes the behaviour of the --upgrade command to preserve the max version specified in a package reference, e.g. <PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="[6.0.13,7)" />.

For example, upgrading a project with would change the version of Microsoft.AspNetCore.Authentication.Negotiate in the csproj from/to:
[6.0.13,7) -> [6.0.36, 7.0.0)
[6.0.13,7] -> [7.0.0]
[6.0.13] -> "No outdated dependencies were detected", as the version is pinned
[6.0.13,) -> 8.0.24
6.0.13 -> 8.0.24
6.* -> 8.0.24
[6.*, 8) -> [7.0.20, 8.0.0)

Note that this does not preserve "floating" versions like 6.*.

However, if the new version is outside the the declared version range (which can happen due to #670), then we remove the maximum version to avoid setting an unsatisfiable version range. e.g. when running dotnet outdated -u -mv 8.0, [6.0.13,7) is updated to 8.0.24 instead of [8.0.24, 7.0.0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Version ranges are not preserved when upgrading packages

1 participant