大马资讯论坛 - 马来西亚中文资讯平台

标题: C# 错误:Mixed mode assembly is built against version 'v2.0.50727' [打印本页]

作者: 资讯王    时间: 2012-3-16 19:02
标题: C# 错误:Mixed mode assembly is built against version 'v2.0.50727'
当我升级我的winform solution去.net framework 4.0,却得到以下错误,说2.0 Library DLL无法执行。
Error 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.

解决方案很简单
1. 去到reference的下面有个app.config,打开它。

2. 把这行拿掉
  1. <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
复制代码
3. 添加
  1.   <startup useLegacyV2RuntimeActivationPolicy="true">
  2.     <supportedRuntime version="v4.0" />
  3.   </startup>
复制代码
4. 结果
  1. <!--<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>-->
  2.   <startup useLegacyV2RuntimeActivationPolicy="true">
  3.     <supportedRuntime version="v4.0" />
  4.   </startup>
复制代码





欢迎光临 大马资讯论坛 - 马来西亚中文资讯平台 (http://freeinfo.com.my/) Powered by Discuz! X3.3