不同版本的.Net程序集 [英] .Net assemblies in different versions

查看:103
本文介绍了不同版本的.Net程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在.net framework 4.0中开发了一个类库,我在其中引用了System.Net.Http命名空间。现在我必须将这个dll引用到我现有的应用程序(运行v3.5)并完成它。执行应用程序时显示以下错误



此程序集由比当前加载的运行时更新的运行时构建,无法加载。



请评论。

Hi,
I have developed a class library in .net framework 4.0 in which i am referring System.Net.Http namespace. Now i have to refer this dll into my existing application(running v3.5) and done it. While executing the application shows the following error

"This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded."

Please comment.

推荐答案

您不能使用旧版本的.net程序集的更高版本(即v3中的v4) .5应用程序)这是因为可能使用较旧的运行时中不存在的较新的运行时功能。



但是你可以做相反的事情(即使用v2 +应用程序中的v2 dll。)



如果你没有使用更新的功能,那么将你的DLL编译成v3.5并使用它。
You cannot use a later version of .net assemblies with an older version (i.e. v4 in a v3.5 application) this is because of the possible use of newer runtime features which don't exist in the older runtime.

You can however do the opposite (i.e. use a v2 dll in a v2+ application).

If you are not using newer features then compile your DLL to v3.5 and use that.


这篇关于不同版本的.Net程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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