.NET Framework 2.0 无法引用 .NET Standard 2.0 [英] .NET Standard 2.0 cannot be referenced in .NET Framework 2.0

查看:36
本文介绍了.NET Framework 2.0 无法引用 .NET Standard 2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到一个错误:

'c:......xxxx.csproj' 目标是 '.NETStandard,Version=v2.0'.它不能被以.NETFramework,Version=v2.0"为目标的项目引用.WindowsFormsApp1

'c:......xxxx.csproj' targets '.NETStandard,Version=v2.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v2.0'. WindowsFormsApp1

如何解决?

推荐答案

很遗憾,您无法在 .NET 2.0 项目中引用 .NET Standard 库.原因是 .NET 2.0 缺少许多关键 API,因此无法实现 .NET Standard 2.0 契约.如果您无法修改 .NET Standard 2.0 库的源代码,唯一的选择是将您的项目升级到 .NET Framework 4.6.1 或更高版本.

Unfortunately you cannot reference a .NET Standard library in .NET 2.0 project. The reason is that .NET 2.0 is missing many key API and hence cannot implement the .NET Standard 2.0 contract. If you cannot modify the source of the .NET Standard 2.0 library, the only option is upgrading your project to .NET Framework 4.6.1 or later.

最有用的参考是官方文档中列出的.NET Standard Compatibility matrix,它显示了不同.NET实现的版本兼容性:

The most useful reference is the .NET Standard Compatibility matrix listed in the official documentation, which shows the version compatibility with different .NET implementations:

从这里可以看出,第一个可以引用 .NET Standard 库的 .NET Framework 版本是 4.5,它仍然不能引用 Standard 2.0,因为它仍然缺少一些 API.

From here you can see that the first .NET Framework version that can reference a .NET Standard libary is 4.5, and it still cannot reference Standard 2.0, because it is still missing some of the APIs.

有关更多详细信息,请查看 .NET Standard 文档.

For further details check out the .NET Standard documentation.

这篇关于.NET Framework 2.0 无法引用 .NET Standard 2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆