views:

330

answers:

4

I realize this is probably a hopelessly newbie question, but what is the difference between the ASP.NET version and the .NET framework version?

I am making an asp.net site using the .net 3.5 framework, but when I echo this;

System.Environment.Version.ToString()

I get "2.0.50727.4927".

Is this then an ASP.NET 2.0 site? This seems odd since I am using visual studio 2008 and the .net 3.5 framework.

+2  A: 

ASP.NET is a web framework written in and utilizing the .NET framework.

What you are getting the the version of the .NET runtime that the ASP.NET site is running under.

This runtime has several extensions to it, and .NET 3.5 is one - it still uses the .NET 2.0 runtime.

You can consider your site to be .NET 3.5 if you have included those libraries and are using their features such as Linq. See wikepedia for more details.

Oded
A: 

.NET 3.5 runs on .NET 2.0.

Daniel A. White
+5  A: 

No, the .NET Framework 3.5 version is simply a set of extra assemblies that are referenced in addition to the core .NET 2.0 assemblies, so calling System.Environment.Version.ToString() will always return 2.0.50727.4927 for all versions from .NET 2.0 up to .NET 3.5.

You're running .NET 3.5 if you're referencing .NET 3.5 assemblies.

David Morton
... a set of extra assemblies + **new C#, VB.NET compilers**.
Mehrdad Afshari
I see, and if I were to use the 3.0 framework instead of 3.5, Microsoft Ajax would not be included?
cc0
Not quite correct. The call he refers to returns the version of the CLR, not the .NET Framework. 3.5 still runs on version 2.x of the CLR.
Justin Niessner
@Mehrdad Afshari - The .NET Framework 3.5 might ship with a new set of compilers, but the compilers and .NET assemblies are independent of each other. You _can_ run .NET 3.5 on C# 2.0, but it would look extremely ugly.
David Morton
@David: Yes, my pedantry was related to your first sentence which may be interpreted as ".NET Framework 3.5 is nothing more than .NET 2.0+new assemblies". Totally minor issue though.
Mehrdad Afshari
+2  A: 

You're getting the CLR version...not the Framework version.

Gets a Version object that describes the major, minor, build, and revision numbers of the common language runtime.

Framework 3.5 still runs on the 2.x version of the CLR.

Justin Niessner