最近在升级到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:
<STARTUP useLegacyV2RuntimeActivationPolicy="true">
<SUPPORTEDRUNTIME version="v4.0" />
<REQUIREDRUNTIME version="v4.0.20506" />
</STARTUP>
</CONFIGURATION>
注意:VS2010 默认也会根据项目添加 STARTUP这个节点,但是仍然会报错。
需要手动添加如下代码,问题才得以解决:
useLegacyV2RuntimeActivationPolicy="true"
<REQUIREDRUNTIME version="v4.0.20506" />