Mixed Mode Runtime Error (v2.0.50727)
From time to time we need to upgrade applications we developed on lower .NET Framework versions to higher .NET Framework versions. Most of the time Visual Studio does this for us with a single click and lets us keep using the application without any problems.
Whether because of the references that were added or the add-ins that were created or used, problems can occasionally come up during the upgrade, rare as they are. I ran into one myself in the application I was working on this evening; after a bit of research I managed to fix the error, and I hope it helps you too.
The Error We Encountered:
The mixed mode assembly was built for version ‘v2.0.50727′ of the runtime and cannot be loaded into the 4.0 runtime without additional configuration information.
Mixed mode assembly is built against version ‘v2.0.50727′ of the runtime and cannot be loaded in …
Solution:
We create a new app.config file, or open the app.config file that the project has already created for us, and edit the code inside it as follows.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
</configuration>
Note: If the app.config file has been generated by the program and you create yet another app.config file and write the code into it, it will conflict with the code in the file the program generated, so please check first.
For more detailed information, see https://msdn.microsoft.com/tr-tr/library/w4atty68(v=VS.110).aspx