NuGet library targeting only netstandard2.0 wont install to net461 project
See original GitHub issueDescription
When I’m trying to install a NuGet package that has only the netstandard2.0 folder to a project that targets net461, the package is added to the paket.references, but the reference is not being added in *.csproj.
As net461 should be implementing netstandard2.0 I’d assume to be able to use a library targeting netstandard2.0 without problems.
In my original issue I am in control of the internal NuGet library, so I could make it to target also net461, but ain’t the key idea of the whole netstandard that I don’t have to explicitly define all the targeted platforms?
Repro steps
- Get the sample repo https://github.com/Gonnagle/paket-tests/releases/tag/paket-issue-2705-repro (paket pinned to version 5.92.0-beta003)
- Run
paket add MP3Sharp -p UberLibrary
Expected behavior
Paket adds the library as a reference to the project UberLibrary (import clause to the *.csproj with a condition matching framework net461).
Actual behavior
Result can be seen in this commit: https://github.com/Gonnagle/paket-tests/commit/56ea3dcdede62cca38c8bb5bd49c7d58978f580c
Paket adds the package to paket.dependencies, paket.lock and paket.referencies, but the *.csproj does not update (on some earlier version I think I was able to get the referencies, but with condition matching only netstandard2.0 and thus references were still missing in this project…)
Suggested solution
Update the library to target at least net471.
As @matthid points out the current stand is that first .net version “properly” implementing netstandard2.0 is net471 so upgrading to that is proposed if such packages are needed.
Other known workarounds
- As a really dirty hack the *.csproj could be changed manually… NuGet also seems to add the reference as expected.
- Update 2018-07-30: When using the new style csproj this doens’t seem to be an issue (nuget dependencies are handled differently and no longer require changes to csproj in the first place…) (NOTE! Kind of a side effect and might not work on all cases)
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (6 by maintainers)
Top GitHub Comments
See discussion in #2391
Thanks @matthid. Updated the first post to reflect these conclusions and posted a request for dotnet team to clarify in their documentation that net471 is actually the first framework to fully implement netstandard2.0: https://github.com/dotnet/standard/issues/514#issuecomment-409836573