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

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.

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!

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 ;-)