Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 931
Charla Avatar asked Dec 11 '22 23:12

Charla


2 Answers

You can also try useLegacyV2RuntimeActivationPolicy="true"

   <startup useLegacyV2RuntimeActivationPolicy="true">
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
    </startup>
like image 107
Dmitry Avatar answered May 21 '23 08:05

Dmitry


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>
like image 34
Adam Baxter Avatar answered May 21 '23 08:05

Adam Baxter