Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
167 views
in Technique[技术] by (71.8m points)

c# - Reference a .net framework 4.5.1 assembly in a 4.0 project

How can i make a 4.0 project have a 4.5 reference. In the unit tests, i cant build the solution and it's giving me this warning.

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

.Net frameworks (v2.0 or higher) are not forward compatible. . You can't reference a .Net 4.5 assembly in .Net 4.0 project.

See: Version Compatibility in the .NET Framework

You may also see: 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...