I\'ve installed the newly released version of Visual Studio 2017 and started a fresh ASP.NET Core project targeting .NET Core.
Out of the box, I\'m getting the
I've tried all answers above. For me works only removal and adding the reference again described in the following steps:
'System' reference you can replace with any you need.
Not quite sure in which order vs 2017 trying to resolve packages. But my situation was following. In my VS2015 I had configured local and 3rd party source for nuget packages, newly installed version of 2017 loaded them too.
https://api.nuget.org/v3/index.json was first in list.
But vs2017 throwed an error that it can't restore .net core libraries from my another local repo.
After I unchecked all of them except https://api.nuget.org/v3/index.json, it had started to working normally.
For me the problem was caused by my project having a custom IntermediateOutputPath
. For some reason, if project_name.csproj.nuget.g.targets
is not in obj
subfolder of project folder, the error occurs.
Using default IntermediateOutputPath
or keeping a shadow copy of project_name.csproj.nuget.g.targets
in fake obj
folder solves the problem for me.
Check the version .NET Command Line Tools in CMD, just type dotnet --info
. If version is 1.0.0
, then try to install latest version .NET Core SDK from here.
The problem for me occurred when running my Visual Studio as Admin with a separate user-- I had created a Git Repo with the source files in the user documents of my normal account. When I created a new solution in that folder the above errors occurred. Try creating your project in a different place and see if the error still occurs.
Multiple closing and reopening of VS2017 fixed it for me.