Preserve version ranges when upgrading packages#702
Open
GREsau wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #388
This PR changes the behaviour of the
--upgradecommand 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.Negotiatein 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.246.0.13->8.0.246.*->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 to8.0.24instead of[8.0.24, 7.0.0).