.NET Coreのプロジェクトをビルドした時に下記のエラーが表示される場合があります。
error : 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: error : 1. The project has not been restored or restore failed - run `dotnet restore` error : 2. The project does not list one of 'win10-x64, win81-x64, win8-x64, win7-x64' in the 'runtimes' section. error : 3. You may be trying to publish a library, which is not supported. Use `dotnet pack` to distribute libraries.
OS等の実行環境に依存するパッケージを追加している場合に表示されます。この場合にはproject.jsonに下記の様に「runtimes~」を追記し実行環境を明記します。
{ "version": "1.0.0-*", "buildOptions": { "emitEntryPoint": true }, "dependencies": { "Microsoft.NETCore.App": { "type": "platform", "version": "1.0.1" } }, "frameworks": { "netcoreapp1.0": { "imports": "dnxcore50" } }, "runtimes": { "win10-x64": {} } }