Jump to content

Programmatically Detecting if .NET is installed


Recommended Posts

Hello everyone,

I have a project where I use a .NET call to automatically determine version information of the software (for display purposes in the About box). The problem I've come across is that sometimes, people have not installed .NET on their computers (I think it's considered an optional Windows update) and the program calls the .NET functions the program gets forever stuck in the call and freezes up the program.

Is there a way to determine if .NET is installed programmatically? I should probably just list this as a requirement for the program to run properly but I would still like to prevent the program from freezing up. So far, my use of .NET hasn't been critical to my program so I could even remove the .NET calls but I really don't want to go down this road if I don't have to.

Thanks,

Bruce

Link to comment

The easiest way to so check the Windows Registry. If the following key exists, the .NET framework has been installed:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework

If you need to know if a specific version has been installed, you can check the sub keys for version numbers.

Patrick

QUOTE (bmoyer @ Nov 18 2008, 02:08 PM)

Hello everyone,

I have a project where I use a .NET call to automatically determine version information of the software (for display purposes in the About box). The problem I've come across is that sometimes, people have not installed .NET on their computers (I think it's considered an optional Windows update) and the program calls the .NET functions the program gets forever stuck in the call and freezes up the program.

Is there a way to determine if .NET is installed programmatically? I should probably just list this as a requirement for the program to run properly but I would still like to prevent the program from freezing up. So far, my use of .NET hasn't been critical to my program so I could even remove the .NET calls but I really don't want to go down this road if I don't have to.

Thanks,

Bruce

Link to comment

QUOTE (bmoyer @ Nov 18 2008, 06:08 AM)

Is there a way to determine if .NET is installed programmatically?

You can also check the file version of mscorlib.dll. It will be located in a subfolder of C:\Windows\Microsoft.NET\Framework. The file version is the .net version - there may be more than one version installed.

Link to comment

Thanks, I created a VI that uses the registry to get the folder that .NET is installed in, and then using info from a MS knowledgebase article (http://support.microsoft.com/kb/318785) to determine the versions installed (I currently don't care which version at this point but it may be useful later on).

Bruce

QUOTE (PWilliams @ Nov 18 2008, 09:58 AM)

The easiest way to so check the Windows Registry. If the following key exists, the .NET framework has been installed:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework

If you need to know if a specific version has been installed, you can check the sub keys for version numbers.

Patrick

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.