I have a scenario where I need a way from the command line to change the version of NuGet package a specific major and minor version but the latest patch version.
i.e if I had the following versions:
1.2.3,1.2.4,1.2.5,1.3.3,1.3.4,1.3.5,2.1.3,2.1.4,2.1.5
And I wanted to swap the package version to 1.2 from 2.1 I want it to pick up the 1.2.5 version, not the 1.2.3 or 1.2.4 versions.
I found that the dotnet add package
command sort of works:
dotnet add package PackageName --version 1.2
This would change the version to 1.2 without an issue, even the package is already in the project, the only issue is it's using the smallest patch version, in this case 1.2.3 instead of 1.2.5.
Is there a good way for me to do the above command but have it pick up the latest patch version?