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.....

<update date="6/4/2010"> Fixed broken link to the sample code. </update>


Comments (18)
  1. tHE LoRd ™ says:

    Any C# or VB.NET code?

  2. 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.

  3. Steven Bone says:

    Hi Aaron, I just checked out the code and it looks great! Thanks for going the extra mile on this one!

  4. Trevor says:

    Unfortunately, the code only works if the user is logged in as an administrator.

  5. 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!

  6. Andrea says:

    Hi Aaron, i don’t view this file. Why?

  7. 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 😉

  8. 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.

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

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

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

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

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

  14. BCaseyHanks says:

    I attempted to access the code at…/detectFX.cpp.txt

    but it always times out.

    Could you please repost and/or email me at copy at

    j (at) MoonTwist (dot) com



  15. Hi BCaseyHanks – That file server no longer exists, but I hadn't have a chance to update this link yet.  You can find an updated download location for this sample code at…/9763379.aspx now.

Comments are closed.

Skip to main content