.Net Core 2.0: project.assets.json’ doesn’t have a target for ‘.NETStandard,Version=v2.0’
The Problem
Odd error when building a .net core project with Visual Studio Code. This built a few weeks ago – went back it it and I’m getting this
C:\Program Files\dotnet\sdk\2.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(165,5): error : Assets file ‘myproject\obj\project.assets.json’ doesn’t have a target for ‘.NETStandard,Version=v2.0’. Ensure that restore has run and that you have included ‘netstandard2.0’ in the TargetFrameworks for your project. [myproject\MyProject.csproj]
.Net Core has been installed, it used to work and there is not much on the Internet. Bafflement.
Solution
Turns out the bin and obj folders for each of the project need to be manually deleted. Once done then the command
dotnet build
gave me the green light and normal service has been resumed. No idea what it going on but sorted now – so I thought I would take a minute and post the solution to my small corner of the Internet. Cheers.
Wow thank you. There is really not a lot on the internet about this. Worked perfectly. NIce to know for later on.
This oddly did the trick for me as well. Move of a temporary solution, but happy to have it. Thanks!