.netruntimeversioningclr-hosting

Is it possible to load two versions of the .NET runtime in the same process?


There are two scenarios I need to clarify:

  1. An executable compiled with .NET 3.5 needs to use a library compiled with .NET 1.1 and the library must run on the 1.1 runtime.

  2. An executable compiled with .NET 1.1 needs to use a library compiled with .NET 3.5.

I cannot find a reliable source stating that it is not possible to load two versions of the .NET runtime and Microsoft's documentation is very vague on this matter.


Solution

  • No -- you can't load the CLR into the same process twice. See the documentation for CLR Hosting

    As with earlier versions of the runtime, the CorBindToRuntimeEx function initializes the runtime. You can choose which version of the runtime to load, but a process can host only one version.