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> <!-- Add the following tag in your appname.exe.config file --> <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.
He has always been interested in computing. He is very passionate when it comes to technology oriented knowledge. He knows that the more that one knows, the more that one needs to learn. Experienced in content management and forms processing, he was a FileNet and Datacap Specialist. He is also a part time gamer and streams sometime.