Question

All,

I have few questions how program's assemblies bind to the underlying CLR version.

1) Is it possible to build/run .net 2.0 app that references .net 4.0 assemblies (which use CLR 4.0)? If so, how?

2) My understanding of the .net framework tells me that referencing .net 2.0 asssemblies in .net 4.0 app (that is build against CLR 4.0) is OK. In this scenario, the app is build and runs under CLR 4.0 but what happens when the referenced assembly (which was build in .net 2.0/3.0/3.5 (CLR 2.0)) is loaded and executes? Does the app load CLR 2.0 now? Or does the code execute under CLR 4.0 which was designed to run older assemblies?

Looking forward to your responses. Feel free to elaborate.

Was it helpful?

Solution

1) No, forwards compatibility is not supported and the application will not compile.

2) Code executes under CLR 4.0 which was designed to run older assemblies. It is backwards compatible for that very reason.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top