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 info

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.

在VS2012上运行一些.net是2.0版本的dll时,会弹出如此错误。大致意思是:混合模式引用是建立针对版本“v2.0.50727”的运行时,不能加载在4.0运行时没有额外的配置信息。

网上查到http://social.msdn.microsoft.com/Forums/vstudio/en-US/58271e39-beca-49ac-90f9-e116fa3dd3c0/mxed-mode-dll-unable-to-load-in-net-40?forum=clr

解决方案如下:

The only way the app config updates worked for me was to add it both to the dll assembly and the project using the dll. Also, I had to use the following config update. This is done on a VS2008 or VS2010 project ported to VS2012.
也就说在配置文件里加上如下信息即可:
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
    <requiredRuntime version="v4.0.20506"/>
  </startup>
</configuration>

至此问题解决,大功告成!!!

你可能感兴趣的:(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 info)