Visual Studio adding DLL as reference error
I'm adding a library to 开发者_JAVA百科a project, and I get the following error:
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.
I'm not too sure about what I have to tweak in order fro this to run. Anyone know what the changes should be?
Thanks,
PM
As Marc says, ideally you'd rebuild in .NET 4, or make your project target .NET 3.5 or lower. Mixed-mode assemblies built for the v2 CLR use "legacy" runtime activation techniques which don't work well with the v4 CLR's ability to run multiple CLRs in the same process.
Alternatively, you can add this information to your app.config:
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
</configuration>
See this question, this documentation and this blog post for details.
Untested, but maybe (from MSDN)
<?xml version="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
I agree that stackoverflow is amazing, but google still does have a place in the world...
From copying and pasting your error into google: http://social.msdn.microsoft.com/Forums/en/clr/thread/58271e39-beca-49ac-90f9-e116fa3dd3c0
Good luck.
精彩评论