找不到与某些项目的目标运行时之一兼容的框架.NETCoreApp = v1的运行时目标 [英] Can not find runtime target for framework .NETCoreApp=v1 compatible with one of the target runtimes for some projects
问题描述
我有许多.NET Core项目的解决方案。我对所有项目进行了NuGet更新,现在尝试构建时出现以下错误(对于某些项目-并非全部):
I have a solution with many .NET Core projects. I did NuGet updates to all of the project and now when I try to build I get the following errors (for some of the projects - not all):
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.
似乎有帮助的是我在这里无法找到框架.NETCoreApp = v1与目标之一兼容的运行时目标运行时
What seemed to help was a post I found here Can not find runtime target for framework .NETCoreApp=v1 compatible with one of the target runtimes
我在失败的项目中添加了以下内容:
I added the following to the failing projects:
"runtimes": {
"win10-x64": { }
}
这似乎可以解决问题。但是我的问题是,为什么这仅在某些项目中发生?没有发出错误的项目的 project.json
文件中没有这样的运行时定义。
That seemed to fix the issue. But my question is, why was this happening only on some projects? The projects that did not issue the error doesn't have such runtime definition in their project.json
file.
此运行时定义到底意味着什么?
What exactly does this runtime definition means? how does it affect my ability to run on other os like linux or mac?
推荐答案
究竟是什么?它对我在其他操作系统上运行的能力有何影响?这个运行时定义是什么意思?
What exactly does this runtime definition means?
runtimes
列出了程序包支持的运行时。 列出运行时对于独立的部署是必需的。部署具有自己的运行时是自包含的。
runtimes
lists the runtimes that our package supports. Listing runtimes is necessary for self-contained deployments. A deployment is self-contained when it brings its own runtime.
我们如何知道我们的部署是否自包含? 依赖项
列出了我们的软件包所依赖的软件包。这些依赖关系分为三种类型。
How do we know if our deployment is self-contained? dependencies
list the packages on which our package depends. These dependencies come in three types.
-
build
该软件包仅用于构建,不属于部署 -
平台
软件包将取决于预安装的运行时 -
默认
都不是
build
the package is for building only and is not part of the deploymentplatform
the package will depend on a pre-installed runtimedefault
neither of those
如果我们的 Microsoft.NETCore.App
依赖项是 default
类型,然后它是独立的,我们需要带上自己的运行时。如果它是 platform
类型,则取决于框架。
If our "Microsoft.NETCore.App"
dependency is of the default
type, then it is self-contained, and we will need to bring our own runtimes. If it is of the platform
type, then it is framework dependent.
为什么这仅在某些项目中发生吗?
why was this happening only on some projects?
它只会在独立部署的项目中发生。如果浏览那些不需要 runtimes
属性的项目,您会发现它们是类库或框架相关的。
It will only happen in projects that are self-contained deployments. If you look thru those projects that do not require a runtimes
property, you will find that they are either class libraries or framework dependent.
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0"
}
}
}
},
"runtimes": {
"win10-x64": {},
"osx.10.10-x64": {}
}
依赖框架的部署
framework dependent deployment
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
}
}
}
类库
class library
"frameworks": {
"netstandard1.6": {}
}
它如何影响我在Linux或Mac等其他操作系统上运行的能力?
how does it affect my ability to run on other os like linux or mac?
t。 Windows,Mac OS和Linux都可以预安装运行时,也可以让应用程序自带运行时。
It doesn't. Windows, Mac OS, and Linux can all either have a runtime pre-installed or have the application bring its own runtime.
另请参见
- https://docs.microsoft.com/en-us/dotnet/articles/core/tools/project-json
- https://docs.microsoft.com / en-us / dotnet / articles / core / deploying / index
- 该链接特别值得一读,以区分自包含和自定义框架依赖性部署。
这篇关于找不到与某些项目的目标运行时之一兼容的框架.NETCoreApp = v1的运行时目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!