C Board  

Go Back   C Board > General Programming Boards > C# Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 05-18-2009, 01:02 AM   #1
Registered User
 
Join Date: May 2009
Location: Arizona
Posts: 35
Get .net framework version

I have an app that targets .net 3.5 but since 3.5 is backwards compatible with earlier versions of the .net framework users can still run my app but with some problems. The errors dont cause it to crash, but an error report is generated and if the user clicks continue the app appears to continue without problems but doesnt perform the actions defined correctly for whatever event would be taking place.

With removing imports to 3.5 only namespaces and changing the compiler target framework to 2.0 plus changing .count to .length where appropriate in my code I can make my app work fully on 2.0 without any problems.

Problem is, with MS supporting installation of .net 3.5 in Windows XP I'd like to keep my application's target framework at 3.5 so I can take advantage of newer features. Because of the problems users get running my app when they've got older versions of .net installed I would like to create an if condition in the app's load event to retrieve the .net version if possible for the end user's system. If its lower than 3.5, I'll have the app promptly let the user know of potential problems.

So...
Code:
if (.netversion < 3.5) {
MessageBox.Show("Update please!");
}
What namespace/function do i use for .netversion?

EDIT: Apologies, its a lot easier than I thought:

Code:
if (System.Enviornment.Version < 3.5) {
MessageBox.Show("Update please!");
}

Last edited by kairozamorro; 05-18-2009 at 03:59 PM. Reason: Corrected errors in code
kairozamorro is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
code for calling the .NET framework version Nyoud33 C# Programming 1 01-12-2009 06:53 AM
migrate from .Net 2.0 to .Net 3.0 George2 C# Programming 3 07-25-2007 04:07 AM
changing the version of .net used in visual c# 2005 Rune Hunter C# Programming 2 02-28-2005 06:55 PM
Problem building Quake source Silvercord Game Programming 14 01-25-2003 10:01 PM
Visual J# mfc2themax A Brief History of Cprogramming.com 0 10-08-2001 02:41 PM


All times are GMT -6. The time now is 02:55 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22