tags:

views:

717

answers:

1

Hello,

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

+9  A: 

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.

DannySmurf
Hi DannySmurf, that's a great answer, thanks for being so quick. I think your overestimating my company's development standards :) I'll look into how to use a manifest (maybe that'll be my next question) Cheers
David A Gibson
3.5 is a little more than a set of assemblies. It also brings a new compiler for C# 3.0
0xA3
divo: The question was about the runtime, not the compiler. They are not the same thing.
DannySmurf