I've updated a class library's project.json
to target netstandard1.3
and net64
.
With that change:
$ dotnet restore
log : Restoring packages
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
/net46
.
How can I diagnose why a higher version is being used instead?
I followed up with this on a NuGet issue and @emgarten pointed out that the NETStandard.Library
package only have a 1.6.0 version, but that 1.6.0 version contains assemblies for netstandard1.3
.
So in this case the 1.3 version I requested doesn't exist anywhere, and the warning is a notification that it's using a higher version instead.
The diagnostic could still be more informative however. You can vote on the issue if it also trips you up and you'd like to see it made more clear.
When you're not dealing with NuGet, but like in my case your own projects, this error can also occur.
The first thing you want to do is make sure you have the correct version referred in the Solution Items -> global.json
.
Then you might need to refresh each project.json referring this project, since VS2015 does not always refresh properly:
Another way to force a refresh is by running dotnet restore --no-cache
at the solution or project level.
For me, just deleting the lock file (project.lock.json
) worked. After deleting this file, Nuget restored all the packages automatically and the problem disappeared.
Disclaimer
Although it worked for me, I am not sure if this is a profound way of doing things that will work for everyone. So please be aware of what you are doing before deleting this file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With