David A Gibson
David A Gibson

Reputation: 2033

Why can't I display the ASP.NET Framework version as 3.5?

Can someone please confirm to me that when my application is written in .NET 3.5 that this code

System.Environment.Version.Major.ToString()

will produce this

2.0.50727.1433

I'm just moving to 3.5 and the first application I'm moving is an internal website. I thought a really easy indicator that it's working would be to add the Framework version next to my Application version but the above text is what is being produced.

My limited research suggests that .NET 3.5 is a 'flavour' of 2.0 and so the underlying framework version will continue to be 2.0. The IIS application pool settings suggest this is the case.

Is this correct or can I get my application to show 3.5?

Cheers

Upvotes: 4

Views: 2337

Answers (1)

TheSmurf
TheSmurf

Reputation: 15568

Because .NET 3.5 uses CLR runtime version 2. 3.5 is just a set of assemblies built on top of the 2.0 runtime. The internal APIs cannot tell the difference. Here is some code that will tell you whether 3.5 is present:

http://blogs.msdn.com/astebner/archive/2007/11/29/6608419.aspx

Note this will not tell you whether your code is actually running against 3.5, but you should be taking care of that in your manifest anyway.

Upvotes: 11

Related Questions