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

查看:210
本文介绍了在.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标准库。原因是.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标准兼容性矩阵,该矩阵显示了与不同.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标准文档

For further details check out the .NET Standard documentation.

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

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