Click here to Skip to main content
15,118,323 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
i Want to run database script in C# code but when i run the project it through exception

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.


Please help....
Posted

In the configuration section of your app.config / web.config, add
XML
<startup useLegacyV2RuntimeActivationPolicy="true">
  <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
The useLegacyV2RuntimeActivationPolicy is the main point here.
   
Comments
Yogesh Kumar Tyagi 15-Jul-14 2:14am
   
thanks sir it will work successfully
I solve it by adding appconfig file with following setting

XML
<?xml version="1.0"?>
<configuration>

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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900