Running .NET 3.5 built Mixed mode assemblies in .NET 4 using app config requires Framework 3.5 as well

后端 未结 2 1420
梦毁少年i
梦毁少年i 2021-01-19 07:06

This is similar to already created thread here: Mixed mode assembly in .NET 4

Using the app config, I was able to force the assemblies to run on .NET 4. On an XP Mac

相关标签:
2条回答
  • 2021-01-19 07:40

    You're experiencing that problem because .NET 3.5 uses the Common Language Runtime (CLR) version2 and .NET 4.0 runs on CLR v4. Therefore if your assembly was built in .NET 3.5, it will only run on a computer that has CLR v2.

    Long story short. Compile your .NET 3.5 assembly as a .NET 4 assembly, otherwise install .NET 3.5 on the target computer as well.


    You can see this site for more information:

    • .NET Framework Versions and Dependencies
    0 讨论(0)
  • 2021-01-19 07:59

    The reason is, that the way how it binds to mixed mode assemblies. Make sure you use the useLegacyV2RuntimeActivationPolicy="true" option in the startup-configuration of you app.config file (which I assume looks similar to the following):

    <startup useLegacyV2RuntimeActivationPolicy="true">
      <supportedRuntime version="v4.0.30319" />
      <supportedRuntime version="v2.0.50727" />
    </startup>
    

    See also: What does 'useLegacyV2RuntimeActivationPolicy' do in the .NET 4 config?

    0 讨论(0)
提交回复
热议问题