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.解决方案
当一个vs2010版本一下的项目转为2010项目时,会遇到这个错误:
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.
搜索下
解决方案如下:
<CONFIGURATION><STARTUP useLegacyV2RuntimeActivationPolicy="true"><SUPPORTEDRUNTIME version="v4.0"/><REQUIREDRUNTIME version="v4.0.20506"/></STARTUP> </CONFIGURATION>
如果不行,修改如下:
<configuration><startup useLegacyV2RuntimeActivationPolicy="true"><supportedRuntime version="v4.0"/></startup></configuration>
至于为什么,帖一段e文的解释
:
After a bit of time (and more searching), I found this blog entry byJomoFisher.One of the recent problems we’ve seen is that, because of the support for side-by-side runtimes,.NET 4.0 has changed the way that it binds to older mixed-mode assemblies.These assemblies are,for example, those that are compiled from C++\CLI.Currently available DirectX assemblies are mixed mode.If you see a message like this then you know you have run into the issue:Mixed mode assembly is built against version 'v1.1.4322' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.[Snip]The good news for applications is that you have the option of falling back to .NET 2.0 era binding for these assemblies bysetting an app.config flag like so:<startup useLegacyV2RuntimeActivationPolicy="true"><supportedRuntime version="v4.0"/></startup>So it looks like the way the runtime loads mixed-mode assemblies has changed. I can't find any details about this change, or why it was done. But the useLegacyV2RuntimeActivationPolicy attribute reverts back to CLR 2.0 loading.
希望能够帮到你