Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additio

来源:互联网 发布:软件测试数据一致性 编辑:程序博客网 时间:2024/06/06 05:25

 

最近在升级到VS2010后,程序出现了如下这条错误:

Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.

 

经过网上查找,最后在CONFIG 中添加如下代码解决,这个文件为appname.exe.config:

 

 

<CONFIGURATION>

    <STARTUP useLegacyV2RuntimeActivationPolicy="true">

         <SUPPORTEDRUNTIME version="v4.0" />

         <REQUIREDRUNTIME version="v4.0.20506" />

    </STARTUP>

</CONFIGURATION>

  

原文地址:http://social.msdn.microsoft.com/Forums/en/clr/thread/58271e39-beca-49ac-90f9-e116fa3dd3c0

注意:VS2010 默认也会根据项目添加 STARTUP这个节点,但是仍然会报错。

需要手动添加如下代码,问题才得以解决:

useLegacyV2RuntimeActivationPolicy="true"

<REQUIREDRUNTIME version="v4.0.20506" />

原创粉丝点击