문제

So i have a mixed-mode dll what i would like to load from my C# class library. But im getting this 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.

So i did some searching and figured out that i should add this to my app.config:

  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>

But now there is the problem, since im trying to load that mixed mode dll from class library i dont have the app.config file.

How could i resolve this problem?

도움이 되었습니까?

해결책

I found this blog post when googling:

http://reedcopsey.com/2011/09/15/setting-uselegacyv2runtimeactivationpolicy-at-runtime/

It's exactly what i wanted and it works!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top