Can not find runtime target for framework '.NETCoreApp,Version=v1.0' compatible with one of the target runtimes: 'win10-x64, win81-x64, win8-x64, win7-x64

Posted by Blake on 3/1/2017
)

If you've found this post you've likely opened up one of your .Net Core web sites, updated the assemblies that Nuget said were available to update and then ran into this pile of errors.

Error - 4. Can not find runtime target for framework '.NETCoreApp,Version=v1.0' compatible with one of the target runtimes: 'win10-x64, win81-x64, win8-x64, win7-x64'. Possible causes: C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets	262
	
Error - 3. You may be trying to publish a library, which is not supported. Use `dotnet pack` to distribute libraries. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets	262	

Error - 2. The project does not list one of 'win10-x64, win81-x64, win8-x64, win7-x64' in the 'runtimes' section. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets	262	

Error - 1. The project has not been restored or restore failed - run 'dotnet restore' C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets	262	

After the update of the .Net core assemblies the errors are telling me that I need to now also specify my target runtime (in the project.json file). The following is the snippet of json that I added to that file to get the local copy of my website working in Visual Studio again.

JSON

  "runtimes": {
    "win10-x86": {},
    "win10-x64": {}
  },

After this is done all you will need to do is a "dotnet restore" or right click your solution/project and tell it to refresh your dependencies there (this may happen automatically, sometimes the tooling picks it up when the project.json file is altered and sometimes it stares blankly pretending not to have seen your edit).