【发布时间】:2017-03-04 15:24:08
【问题描述】:
我有一个包含许多 .NET Core 项目的解决方案。我对所有项目进行了 NuGet 更新,现在当我尝试构建时出现以下错误(对于某些项目 - 不是全部):
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, win8-x64, win7-x64' in the 'runtimes' section.
3. You may be trying to publish a library, which is not supported. Use `dotnet pack` to distribute libraries.
似乎有帮助的是我在Can not find runtime target for framework .NETCoreApp=v1 compatible with one of the target runtimes 找到的一个帖子
我在失败的项目中添加了以下内容:
"runtimes": {
"win10-x64": { }
}
这似乎解决了问题。但我的问题是,为什么这只发生在某些项目上?未发出错误的项目在其project.json 文件中没有此类运行时定义。
这个运行时定义到底是什么意思?它如何影响我在 linux 或 mac 等其他操作系统上运行的能力?
【问题讨论】:
-
您能否举一个 project.json 示例来说明一个可行的项目和一个不可行的项目?
标签: .net asp.net-core .net-core asp.net-core-1.0