Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

.net

version

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

like image 887
David A Gibson Avatar asked Dec 23 '22 13:12

David A Gibson


1 Answers

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.

like image 190
TheSmurf Avatar answered Jan 15 '23 01:01

TheSmurf