Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / December 2007

Tip: Looking for answers? Try searching our database.

Framework version

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lou - 09 Dec 2007 15:36 GMT
How can I programmatically get the current framework version?
-Lou
Mattias Sjögren - 09 Dec 2007 19:28 GMT
>How can I programmatically get the current framework version?

System.Environment.Version will get you the CLR version loaded into
the process (so it will be 2.0 even if you use 3.x libraries).

Mattias

Signature

Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

VistaDB - 28 Dec 2007 19:42 GMT
> System.Environment.Versionwill get you the CLR version loaded into
> the process (so it will be 2.0 even if you use 3.x libraries).

Why is that so?  Even if I build a new app under VS 2008 with 3.5 as
the target the Environment.Version returns 2.0....
Peter Duniho - 28 Dec 2007 19:56 GMT
>> System.Environment.Versionwill get you the CLR version loaded into
>> the process (so it will be 2.0 even if you use 3.x libraries).
>
> Why is that so?  Even if I build a new app under VS 2008 with 3.5 as
> the target the Environment.Version returns 2.0....

That's correct.  It's because the CLR version hasn't changed, even though  
the marketing version for .NET has.  .NET 3.0 and 3.5 are still using CLR  
2.0, they just have new classes and other features (like a new C# version).

I do think it's a little confusing, but to some extent the question of the  
overall .NET version isn't so important since if your application depends  
on a specific version it won't get far enough when loading for execution  
to get a chance to check the CLR version, and at least for .NET 3.0 and  
3.5 there aren't any additions that should affect your own code the way  
that a change in the CLR version could.

Pete

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.