21

What exactly does the .NET 4.0 runtime do if a .NET 4.0 executable contains a reference to a .NET 2.0 assembly?

Is the .NET 2.0 assembly run with the .NET 4.0 runtime (in other words, .NET 4.0 must be 100% API-compatible to .NET 2.0) or does the process somehow host the .NET 2.0 runtime and some magic happens to make the .NET 2.0 types transparently accessible to my .NET 4.0-based code?

Cygon
  • 9,444
  • 8
  • 42
  • 50

1 Answers1

17

They say it should work fine. Check out this.

m0s
  • 4,250
  • 9
  • 41
  • 64
  • Thanks. That sounds like the code will actually be executed by the .NET 4.0 CLR if loaded by a .NET 4.0 application. Still looking for some solid, official statement about this on MSDN, but haven't unearthed it yet. – Cygon Apr 16 '10 at 21:51
  • 1
    I'm tagging this as the answer because it lead me to the most useful information about the subject. When a .NET 4.0 application loads a .NET 2.0 assembly, it is indeed run within the .NET 4.0 CLR. There are even subtle differences (most important the security model) than can make .NET 2.0 assemblies fail to work without additional tweaks to the app.config file (log4net being one of those problem assemblies.) – Cygon Jun 22 '10 at 09:50