Share

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

Dysfunktion CR3W

If your application has a dependency on an assembly built in .NET 2 Framework you will see the error below if you try to run your application when it has been built in.NET 4.

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.

I've encountered this error while using System.Data.SQLite.dll for my project. Since it was built on .Net 2 framework, it pops out the error.

To fix this, you need to add the useLegacyV2RuntimeActivationPolicy attribute to the application .CONFIG file in the same dir or your app, eg appname.exe.config. The config file should read as follows: 

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <startup useLegacyV2RuntimeActivationPolicy="true">
            <supportedRuntime version="v4.0" />    
</startup>


  <runtime>
    <generatePublisherEvidence enabled="false" />
  </runtime>
</configuration>


Well this enables my .Net 4 application to use cross framework assemblies.

 

 

Trackback

Trackback URL for this entry: http://blog.yusri.com.my/v2/trackback.php/dotnet2asmindotnet4

No trackback comments for this entry.

0 comments

# /boot/menu.conf

# /main/
 /home
 /mylife
 /DysfunktionCR3W
 /spaceXploration
 /life, engineered

# /interact/

 /my wishlist!
 /my travel map
 /mediagallery
 /my toolbox
 /syok shout/

# /stuff/

 /hmsecurity
 /n3wb0rn
 /slashdot
 /the broken
 /distrowatch
 /quantum computing
 /kernel

Shout Out~!

My Account





Sign up as a New User
Lost your password?


# /home/yusri/favlink

Slackware Linux
The linux distro i love!



SMK Sultan Badlishah

# /boot/boot.conf




Umbrella Corporation

# /etc/lic

License

Creative Commons License

WTFPL

Waktu Solat

#/adv


tweetshyt!