2

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

user472875
  • 3,115
  • 4
  • 37
  • 68

3 Answers3

2

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.

Community
  • 1
  • 1
Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
1

Untested, but maybe (from MSDN)

<?xml version="1.0"?> 
<configuration> 
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> 
  </startup> 
</configuration>
Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
0

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.

SpeksETC
  • 1,003
  • 2
  • 7
  • 13
  • Yes, I googled it first as well and came up with that same page. As far as I understand it, this makes the entire project run in a compatibility mode, which I have to avoid. – user472875 Nov 30 '10 at 07:04
  • 3
    That information would be useful to post so people know what you tried and what you're requirements are (e.g. not use "compatibility mode") – SpeksETC Nov 30 '10 at 07:07