Click here to Skip to main content
15,170,602 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....

In the configuration section of your app.config / web.config, add
<startup useLegacyV2RuntimeActivationPolicy="true">
  <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
The useLegacyV2RuntimeActivationPolicy is the main point here.
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 version="1.0"?>

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

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