Welcome to MSDN Blogs Sign in | Join | Help

Sample code to detect .NET Framework 1.0 and 1.1 and service packs

Hey all,

In response to some suggestions from folks who read my blog posts describing how to detect the presence of .NET Framework 1.0 service packs and .NET Framework 1.1 service packs, I wrote up a quick sample application that shows how to implement the detection methods I recommended.  You can download the sample code here.

In this sample, I detect the presence of the .NET Framework core packages for 1.0 and 1.1, and then if I find that they are installed, I detect the service pack level also.  The sample simply pops up a message box for each version, but could be easily updated to perform some conditional action (as part of a 3rd party setup or something like that).

The code is provided as an example only....I hope it will help better explain how to implement a detection strategy for the .NET Framework and its service packs that will continue to work when future service packs are released.  Let me know if you have any problems or questions.....

 

Published Saturday, September 18, 2004 12:23 PM by astebner
Filed under:

Comments

Sunday, September 19, 2004 5:27 AM by tHE LoRd ™

# re: Sample code to detect .NET Framework 1.0 and 1.1 and service packs

Any C# or VB.NET code?
Sunday, September 19, 2004 7:37 AM by Aaron Stebner

# re: Sample code to detect .NET Framework 1.0 and 1.1 and service packs

I didn't write this sample in managed code because it is used to detect if the .NET Framework is on the machine so it wouldn't even run if it turns out that there is no .NET Framework on the machine. I was also thinking that code would be used as part of another setup package, and I don't recommend using managed code as part of a setup when it can be avoided (due to the additional overhead of the .NET Framework being used during setup). It should be straightforward to convert it from C++ to C#/VB though.
Sunday, September 19, 2004 5:19 PM by Steven Bone

# re: Sample code to detect .NET Framework 1.0 and 1.1 and service packs

Hi Aaron, I just checked out the code and it looks great! Thanks for going the extra mile on this one!
Tuesday, September 21, 2004 3:05 PM by AddressOf.com

# Determine if and what version of the .NET Framework is installed (including service pack levels)?

Tuesday, September 21, 2004 2:10 PM by Trevor

# re: Sample code to detect .NET Framework 1.0 and 1.1 and service packs

Unfortunately, the code only works if the user is logged in as an administrator.
Tuesday, September 21, 2004 7:39 PM by Aaron Stebner

# re: Sample code to detect .NET Framework 1.0 and 1.1 and service packs

It is true that this code requires more than normal user privileges. However, the registry keys being queried are under HKEY_LOCAL_MACHINE, which I believe requires at least Power User privileges. Can you explain what scenarios you would want to use this code as a normal user? Thanks!
Wednesday, September 22, 2004 11:47 PM by Andrea

# re: Sample code to detect .NET Framework 1.0 and 1.1 and service packs

Hi Aaron, i don't view this file. Why?
Thursday, September 23, 2004 12:17 PM by AddressOf.com

# Determine if and what version of the .NET Framework is installed (including service pack levels)?

I came across an excellent example that shows how to determine what editions and service pack level of the existing Microsoft .NET Framework is installed. Unfortunately for most of my readers, this code was in C . I've converted the code to VB.NET for everyone to benefit ;-)
Thursday, September 23, 2004 4:32 PM by Aaron Stebner

# re: Sample code to detect .NET Framework 1.0 and 1.1 and service packs

Andrea - it appears that there was an issue last night with the site that is hosting the CPP file with this sample code, but it appears to be working fine now.

If anyone out there still cannot get it to download please send me an email at aaronste (at) microsoft (dot) com and I will send it to you directly.
Tuesday, July 12, 2005 11:08 PM by Aaron Stebner's WebLog

# What .NET Framework version numbers go with what service pack

I got a comment from a customer in response to a previous blog post asking about file versions for the...
Tuesday, December 27, 2005 2:38 PM by Cory Smith

# re: Sample code to detect .NET Framework 1.0 and 1.1 and service packs

For a VB.NET conversion of this code, visit http://addressof.com/blog/archive/2004/09/21/926.aspx
Friday, April 07, 2006 8:20 PM by Heath Stewart's Blog

# Detecting Patches in .NET 2.0 and Visual Studio 2005

How to detect certain patches applied to .NET 2.0 and Visual Studio 2005.
Wednesday, March 21, 2007 12:53 AM by Aaron Stebner's WebLog

# What .NET Framework version numbers go with what service pack

I got a comment from a customer in response to a previous blog post asking about file versions for the

# Alex Lowe on Software and Technology » Detecting Installed Microsoft .Net Framework (CLR) Version Information

Tuesday, December 04, 2007 5:33 PM by Heath Stewart's Blog

# Detecting Patches in .NET 2.0 and Visual Studio 2005

How to detect certain patches applied to .NET 2.0 and Visual Studio 2005.

Friday, May 29, 2009 4:46 PM by Aaron Stebner's WebLog

# Updated sample .NET Framework detection code that does more in-depth checking

I previously posted some sample code to detect the version(s) and service pack levels of the .NET Framework

Anonymous comments are disabled
 
Page view tracker