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:
The project has not been restored or restore failed -run ‘dotnet restore’
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 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.
Update 27 February 2017
New project templates in Visual Studio 2017 RC no longer require run times to be specified (in project.json or .csproj) in advance if you choose to deploy your app as a Framework Dependent Deployment (FDD).
If, however, you choose to deploy your app using Self-contained Deployment (SCD), then you will need to specify all the run times you want your app to run on in advance in your .csproj file.
Below is an example of a .csproj file for an app that uses the SCD deployment method:
Please see this link for more information, which includes a thorough description of both types of deployment options, as well as their benefits and disadvantages.