An annoying error can be revealed when you see the message “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.” It happens when you try to load dll compiled within .NET framewrork 2.0.
The solution is quite simple.
Edit you app.config file (if you don’t have it, just add it to your project)
<?xml version="1.0"?> <configuration> <startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/> </startup> </configuration>
The useLegacyV2RuntimeActivationPolicy attribute will enable you to load dll compiled with .NET framework 2.0.
The useLegacyV2RuntimeActivationPolicy attribute basically lets you say, “I have some dependencies on the legacy shim APIs. Please make them work the way they used to with respect to the chosen runtime.” Look here for more details.