Article content:
1. The problem leads
2. Problem solving
3. Causal analysis
Recently, the development environment of the department has been updated to Win7+.net framework4+vs2010, which brings some compatibility problems while experiencing the ways and means of improving the efficiency of new technology and environment; These days the project is studying SQLite in leisure time, In doing the experiment when encountered a problem, code compilation through the execution of repeated abnormal interruption, check to the back of the original is SQLite.dll in the framework2.0 environment is compiled and now the operating environment is framework4.0, so there is a running exception, as shown:
Because some Third-party components may be referenced later in the development process, possibly compiled under the old version of the framework, this type of problem can also occur, so provide a workaround in this article and explain the cause of the problem.
After consulting the relevant information, the Stackoverflow.com recommends adding the configuration in config file:
Copy Code code as follows:
<startup uselegacyv2runtimeactivationpolicy= "true" >
<supportedruntime version= "v4.0"/>
</startup>
This approach is also illustrated on MSDN, see HTTP://MSDN.MICROSOFT.COM/EN-US/LIBRARY/BBX34A2H (vs.100). aspx
However, the problem of compiling with this method is still unresolved, but the problem can be clearly locked into a. NET runtime environment.
Copy Code code as follows:
<startup uselegacyv2runtimeactivationpolicy= "true" >
<supportedruntime version= "v4.0"/>
<requiredruntime version= "v4.0.30319"/>
</startup>
Run again, problem solved. What do you need to know about the cause?
The supportedruntime tag is used to specify which of the applications is supported. The version of the framework runtime;
The Requiredruntime label is used to specify that the application supports only version 1.0 of the common language runtime. If you compile with version 1.1 or later, the application must use the <supportedRuntime> element;
Note:
<supportedRuntime> must be used by applications compiled with version 1.1 or later. Applications that support only version 1.0 of the run time must use <requiredRuntime>.
Again, refer to the CLR runtime version for information, referencing the following CLR run rules and the Relationship Rollup table for each version, as follows:
Rules:
1. Applications compiled by CLR4.0 and above always run on the CLR version of the application being compiled;
2. Applications compiled with the following versions of CLR4.0 run on the compiled CLR version and run the latest version less than CLR4.0 if this version does not exist;
The summary is as follows:
EXE the compiled CLR Version number |
a CLR 1.1 is installed on the machine ? |
Is there a CLR 2.0 installed on the machine? |
Is there a CLR 4.0 installed on the machine? |
Results |
1.1 |
Is |
Doesn't matter |
Doesn't matter |
Loading CLR 1.1 |
2.0 |
Doesn't matter |
Is |
Doesn't matter |
Loading CLR 2.0 |
1.1 |
Whether |
Is |
Doesn't matter |
Loading CLR 2.0 |
1.1 |
Whether |
Whether |
Is |
Failed |
2.0 |
Doesn't matter |
Whether |
Is |
Failed |
So we can clearly understand the connection between the various versions of the CLR.
Summary: Microsoft every version of the upgrade will create some new problems, early from CLRv1.0 to CLRv2.0 once caused a lot of confusion, may also be due to too large organizations do not cover it, hope that in the future version upgrade can really seamless version of the connection.