views:

426

answers:

3

Let's say I have a .NET user application (.exe) running under Windows that was compiled in .NET Framework Version 3.0 (VS2008). If that application loads another .NET Assembly (.dll) that was compiled on a different computer using .NET Framework Version 2.0 (VS2005), will the loaded assembly use the existing 3.0 runtime (which will run in backwards compatibility mode)? Or will the .NET Framework 2.0 runtime load into the system's process space, and we now have two .NET runtimes running concurrently?

Assertion: This is not using VS2008 multi-targeting.

Thanks in Advance.

+5  A: 

There is no .NET 3.0 CLR. .NET 3.0 and 3.5 both use the .NET 2.0 CLR.

Of course, if your .NET 3.0 application uses .NET 3.0 features, then .NET 3.0 will need to be installed.

John Saunders
Oh neat, I didn't realize that. So all that 3.0 and 3.5 are is a bunch of new assemblies (foundations, etc) that you can use in your code.
Todd
+1  A: 

If it is in the same process space, as you have outlined, it will run under 3.0. If you want two different CLRs to spin up, you will have to create a service boundary (web service or WCF works fine here - not WCF for 2.0 obviously) and call the service from the other app.

Gregory A Beamer
Gregory, when you say two different CLRs, do you mean .NET 1.1 CLR? Because after that, there's .NET 2.0 CLR and the unreleased .NET 4.0 CLR.
John Saunders
Yes, technically, there is only 2.0 with 3.0 and 3.5 sitting on top. But it is a bit more complex than that, as technically, there are libraries you can sit on top of 2.0, while having released libs installed for 3.5. AJAX comes to mind.
Gregory A Beamer
But, technically, you have 1.0, 1.1 and 2.0 as the three base libs.
Gregory A Beamer
A: 

.NET runtime versions are usually backwards compatible, so the 3.0 runtime will host the 2.0 assembly (not to mention that 3.0 is basically the same runtime as 2.0). In any case, two versions of the CLR cannot be loaded to the same process.

On Freund