-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NuGet is restoring wrong version if referenced indirectly from lib #6563
Comments
what does priority:1 mean? |
Bumping this issue. This is incorrect behavior and provides no hints at resolution. The workarounds listed here are not solutions and are not sustainable when using centrally managed package versions. |
The original issue creator was misreading NU1608 message (which is a warning, by the way, it's only displayed as an error if your project opt-in to warnings as errors). The message is saying that there's a package, Microsoft.Data.Services.Client that has a dependency on package Microsoft.Data.OData version =5.8.2. Note that most packages list dependencies as versions There is no "one resolution for all scenarios". Maybe the package that specified an overly restrictive dependency version range is actually safe, so you can either stop treating all warnings as errors, and ignore the warning. Or you can use What is more common, is for packages to list the version range as In my opinion, this issue, as it's written, should be closed as the statement that NuGet was restoring the wrong version is incorrect. Maybe the NU1608 docs should be improved to mention NoWarn. @enioluwas brings up an interesting point about how easy this is with Central Package Management (I'm assuming with transitive pinning enabled) (fyi @jeffkl). |
Thanks for the response @zivkan, I agree with your assessment that this is not incorrect behavior, as Nuget is not restoring the "wrong" version, it's just that, at least in my case, a package is being resolved to a version higher than the minimum specified by another package that references it, both of which my app depends on. This is what is emitting the NU1608 warning. For packages A and B this is what it looks like: Package A (1.0) -> Package B ( >= 4.0) As you called out, with central package management, it's easy to run into this, and the workaround can snowball into extensive version overrides/NoWarn tags in all the affected projects. Suppressing the warning globally works of course, but I would rather have an easy way suppress this warning only for Package B and its transitive references, since I know Package B is fully backwards compatible. However I think this issue points out that there's no easy way to do that right now. |
Team Triage: Closing the original issue as we do not think there's a bug in this scenario. @enioluwas Please feel free to create a new issue for any problems you might have that aren't represented. |
Issue is missing Type label, remember to add a Type label |
Original issue by @pshrosbree fsprojects/Paket#2976
The attached projects shows an inconsisteny when referencing packages indirectly. Just run
dotnet build
in theapp
folder and see it fail withNU1608
:The problem is the following. In the
lib
project we explicitly select Microsoft.Data.Services.Clientversion 5.8.3 for
net461, but this is just ignored during the build an NuGet decides to just use
5.8.2` instead. This introduces a version conflict. Note: NuGet is overriding my manual settings!version.zip
WORKAROUNDS
While this behaviour leads to very weird errors, there are 2 workarounds:
a) go to
lib
folder and use<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
b) go to
app
folder and add explicit<PackageReference Include="Microsoft.Data.Services.Client" Version="5.8.3" />
The text was updated successfully, but these errors were encountered: