-
Notifications
You must be signed in to change notification settings - Fork 256
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
Application targeting net462 imports library targeting net451 instead of library targeting netstandard2.0 #5370
Comments
I believe this is by design in terms of precedence. Same target framework identifier is considered "nearer" than compatible identifier. |
This is correct. Desktop frameworks win over non-desktop frameworks. NuGet tries to find the largest compatible API surface area. |
Should this change with Lots of libraries maintain |
An additional package is not needed, authors can add net461 or net47 to the same package.
If for example the project is net47 and the package contains net47 and netstandard2.0 the user should still get net47, the desktop framework is an identical match. In the case of net45 vs netstandard2.0 there are APIs that are available in net45 that are not in netstandard2.0, NuGet can't determine exactly which is going to be a better match for the user so it leaves it up to the package author. Authors can rely on NuGet to favor a match within the same framework, and can add support for higher versions of it if they are actually using APIs beyond the net45 API surface area. |
Since this is working as designed it should be OK to close then. Thanks for explaining why Desktop is preferred over |
From @caleblloyd on June 8, 2017 1:24
Steps to reproduce
dotnet restore
Expected behavior
net46
should import librarynet451
net462
should import librarynetstandard2.0
netcoreapp1.1.2
should import librarynetstandard1.3
netcoreapp2.0
should import librarynetstandard2.0
Actual behavior
All of the above are true except for App
net462
imports librarynet451
. Sincenet462
supportsnetstandard2.0
, andnetstandard2.0
is newer thannet451
, shouldn't the app targetingnet462
import the library targetingnetstandard2.0
instead?Here is the pruned
obj/project.assets.json
:Environment data
Copied from original issue: dotnet/cli#6798
The text was updated successfully, but these errors were encountered: