Blake Mumford Blake Mumford - 2 months ago 319
ASP.NET (C#) Question

Can not find runtime target for framework .NETCoreApp=v1 compatible with one of the target runtimes

I am trying to migrate an Asp.Net Core RC1 project to RC2 and have been following this documentation and have also followed the instructions for DNX migration to .NET CLI.

I am getting the following error when I try

dotnet run
:


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:


  1. The project has not been restored or restore failed -run 'dotnet restore'

  2. The project does not list one of 'win10-x64, win81-x64, win7-x64' in the 'runtimes'




I have run
dotnet restore
and it seems to have completed successfully.

I have updated all the relevant packages to RC2.

Answer

I should have done exactly what the error message said. When migrating from RC1, I did not realise that I had to specify a runtimes section in my project.json file.

In my project.json I added the following section:

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

And I was good to go.