Matthieu Napoli
Matthieu Napoli

Reputation: 49533

Does .NET framework 4 includes version 3?

This may be a silly question, but googling that is not very effective. And Wikipedia is not helpful on that matter either.

I have a library that requires .NET framework 3, but I have version 4 installed, do I need to install something? Same question goes for when other people will download my code: what instructions will I need to give.

Upvotes: 0

Views: 1006

Answers (2)

Vlad
Vlad

Reputation: 35584

Well, strictly speaking, .NET 4 doesn't include .NET 3. It's even based on different runtime. However, the .NET 4 apps may use the .NET 3 libraries (you would some special setting in app.config). A better approach would be of course getting .NET 4 version of the library.

(For example, if your application uses mixed-mode assemblies, you might require useLegacyV2RuntimeActivationPolicy flag.)

Upvotes: 1

Darin Dimitrov
Darin Dimitrov

Reputation: 1038710

No, you don't need to install anything. The CLR 4.0 (which is used by .NET 4.0) can load and run assemblies compiled against .NET 3.0. But they will run under the CLR 4.0 compared to the CLR 2.0 they were built for. While not necessary if you have the source code you might recompile it to target .NET 4.0. The opposite of course is not true: assemblies built for .NET 4.0 will not be able to run on the CLR 2.0.

And as @marc_s mentions in the comments if you do need the CLR v2 (.NET 2.0/3.0/3.5) separately for some reaon, you need to install a suitable .NET framework separately - .NET 4 does not include the "old" CLR v2.

Upvotes: 4

Related Questions