2
votes

I'm adding a library to 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

3
is "compile the library in 4.0" an option?Marc Gravell
not sure if I follow, you mean rebuild the library in 4.0? no I can't.user472875

3 Answers

2
votes

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.

1
votes

Untested, but maybe (from MSDN)

<?xml version="1.0"?> 
<configuration> 
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> 
  </startup> 
</configuration>
0
votes

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.