Home: warning "Dependency specified was X but ended up with Y" should come with a reason

Created on 5 May 2016  路  11Comments  路  Source: NuGet/Home

Example:
warning NU1007: Dependency specified was NuGet.Services.Metadata.Catalog >= 3.0.2137-r-searchcloud but ended up with NuGet.Services.Metadata.Catalog 3.0.2315-r-sc-appinsights.

It's very useful for the user to understand why the replacement occurs, in order to fix the warning.

ErrorHandling 3 Bug

Most helpful comment

I've landed here while searching to find out the meaning of this diagnostic. In my case it's:

warn : Dependency specified was NETStandard.Library (>= 1.3.0) but ended up with NETStandard.Library 1.6.0.

I'm publishing a library and really need to target netstandard1.3 or earlier.

How can I diagnose why a higher version is being used instead?

All 11 comments

Perhaps we list the couple of reasons why this may happen, if perf is impactful.
@skofman1 - can you please update the result when running on update 2

I've landed here while searching to find out the meaning of this diagnostic. In my case it's:

warn : Dependency specified was NETStandard.Library (>= 1.3.0) but ended up with NETStandard.Library 1.6.0.

I'm publishing a library and really need to target netstandard1.3 or earlier.

How can I diagnose why a higher version is being used instead?

@drewnoakes NETStandard.Library 1.6.0 contains assemblies for netstandard1.3, there isn't a NETStandard.Library 1.3.0, but I can see how it would be easy to expect that :smile:

@emgarten thanks for replying. In that case, is there any action I should take regarding this warning? I'd like to have a warning-free build. Should I just set the dependency to NETStandard.Library 1.6.0?

EDIT just tried this and yes, setting NetStandard.Library to 1.6.0 got rid of the warnings.

just tried this and yes, setting NetStandard.Library to 1.6.0 got rid of the warnings.

That's the correct approach. The warning was because 1.3.0 means >= 1.3.0, and 1.6.0 is the lowest available.

That fact wasn't obvious, and I didn't find a good reference online with the error message, though I guess that's what this issue is tracking.

Thanks again for clearing things up for me.

I'm receiving this warning: Dependency specified was System.Net.Http >= 4.3.1 but ended up with System.Net.Http 4.0.0.0. I need to run System.net.Http 4.3.1 in order to beat an exception that I am receiving: "Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)" I'm using EntityFrameworkCore and class libraries, I have read that installing System.Net.Http version 4.3.1 I could get rid of that exception but I'm receiving this warning when I try to use System.Net.Http version 4.3.1

@emgarten, @drewnoakes how to change dependency in Core 2.0? The only place I can find is \obj\project.assets.json but "obj" folder is not a permanent part of the project.

This has been fixed with the work around warnings and errors. The message should now describe that the package version was not found and that an approximate best match was used.

@emgarten, you're right:

DeepCloner 0.10.1 depends on NETStandard.Library (>= 1.3.0) but NETStandard.Library 1.3.0 was not found. An approximate best match of NETStandard.Library 1.6.0 was resolved.

but is there a way to hide this warning as unimportant?

@DevelAx you can suppress warnings with <NoWarn>NU1603</NoWarn> in your project file.

Was this page helpful?
0 / 5 - 0 ratings