.NET Standard 2.0 cannot be referenced in .NET Framework 2.0

只谈情不闲聊 提交于 2019-12-08 19:49:59

问题


I received an error:

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

How to resolve?


回答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.

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

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.

For further details check out the .NET Standard documentation.



来源:https://stackoverflow.com/questions/48219340/net-standard-2-0-cannot-be-referenced-in-net-framework-2-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!