如何使 4.0 项目具有 4.5 引用。在单元测试中,我无法构建解决方案,它给了我这个警告。
Warning 2 The primary reference "PR.Wallet" could not be resolved because it was built against the ".NETFramework,Version=v4.5.1" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0". PR.Wallet.Tests
最佳答案
.Net 框架(v2.0 或更高版本) 不是 forward compatible . .您不能在 .Net 4.0 项目中引用 .Net 4.5 程序集。
参见:Version Compatibility in the .NET Framework
您还可以看到:Version Compatibility
The degree of .NET Framework support for backward and forward compatibility is version-specific. The .NET Framework supports both backward and forward compatibility for applications created using version 1.1 only. It does not support forward compatibility in applications created using version 2.0. In the context of the .NET Framework, backward compatibility means that an application created using an early version of the .NET Framework will run on a later version. Conversely, forward compatibility means that an application created using a later version of the .NET Framework will run on an earlier version.
The .NET Framework provides a high degree of support for backward compatibility. For example, most applications created using version 1.0 will run on version 1.1 and applications using version 1.1 will run on version 2.0. The .NET Framework also supports forward compatibility for version 1.1 only. However, for forward compatibility you might need to modify an application so that the application runs as expected. Applications created with version 2.0 will not run on earlier versions of the .NET Framework. For both backward and forward compatibility, a change to the .NET Framework that helps improve security, correctness, or functionality might also raise compatibility issues.
关于c# - 在 4.0 项目中引用 .net Framework 4.5.1 程序集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23807351/