Mixed mode assembly is built against version '

2019-06-28 05:43发布

I got this exception after runing an execuable in command line execution:

"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."

After search this issue on internet, I found one of the way out is to configure App.Config file. That works fine in VS2010 but still generates same error in command mode.

So is there any way to resolve this by using command line as generating newer version of .dll is impossible.

Thanks!

3条回答
走好不送
2楼-- · 2019-06-28 05:54

You can also try useLegacyV2RuntimeActivationPolicy="true"

   <startup useLegacyV2RuntimeActivationPolicy="true">
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
    </startup>
查看更多
家丑人穷心不美
3楼-- · 2019-06-28 05:54

Another solution can be to recompile all mixed(C++/CLI) assemblies you are dependent on for .NET 4.0. It is often not possible if these assemblies are third party.

查看更多
别忘想泡老子
4楼-- · 2019-06-28 06:09

Make sure you have configured both the App.config and the ProgramName.exe.config file.

For example:

<configuration>
    <startup>
      <supportedRuntime version="v2.0.50727"/>
   </startup>
 </configuration>
查看更多
登录 后发表回答