Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Nuget update should provide informative message when a higher version is restricted by allowedVersions constraint #3013
It should have throw error something "unable to resolve this package...." since available version was restricted by constraint.
It simply said "There are no new updates available." and passed.
Not really this behavior is because of the fix of 1816, which is to prune disallowed versions first and then pick the highest. If you've multiple versions n some of your highest versions are disallowed then you can still get a version to update which should happen. Then another case, is you only have 2 versions where 1.0 is already installed and 2.0 is disallowed then you should throw error to communicate otherwise user might not be able to understand why it was not updated.
So I'll tweak this code a little, just to throw error in case no version is available to update after pruning all disallowed versions.
This will be problematic for users who set allowedVersions to restrict the package to the highest version of a certain set. For example if a user wants to stay on version 3.4.x of the NuGet packages today they could add [3.4.0, 3.5.0) to avoid the 3.5.x packages.
In the scenario the above the user is aware that there are higher versions, they added allowedVersions to avoid them. Taking the advanced allowedVersions feature and turning it into a non-advanced scenario will make this somewhat annoying.
See also this issue, it is for update all instead of updating a single package, but I think the same thing applies to some degree: #916
Here is the behavior in 2.8.6
<?xml version="1.0" encoding="utf-8"?> <packages> <package id="Newtonsoft.Json" version="6.0.1" targetFramework="net45" allowedVersions="[6.0.0, 7.0.0)" /> </packages>
It has extra info about why it didn't update, but it doesn't consider it an error. Maybe go with that behavior?