Updated sample code that detects .NET Framework 2.0

A while back I posted some sample code in C++ that can be used to detect whether or not the .NET Framework 1.0 or 1.1 is installed, and if so, what service pack is installed.  I've been meaning to update the code to detect 2.0.  Now that the final version number for the .NET Framework 2.0 has been locked to v2.0.50727, I don't have any excuse to put this work off any longer.  Plus I got an email from a customer asking about this detection, and that finally provided the motivation I needed to do this.  🙂  You can find updated detection code for the .NET Framework that includes 2.0 at this location.  Hope this helps!


Comments (6)
  1. John Bates says:

    Hi Aaron, just tried the sample.

    As is, it won’t work correctly if you’re running as a normal user instead of an Administrator.

    The RegistryGetValue() function asks for (unneeded) KEY_WRITE access; removing this (leaving just KEY_READ) makes everything OK.

    Regards, John Bates.

  2. Sven says:

    So the August CTP contains the final version of .NET 2.0 Framework?

  3. John – thank you for finding that issue. I will update the sample code accordingly.

    Sven – no, the August CTP does not have the final version of the .NET Framework 2.0, but the major/minor version number is locked starting then. That means that the final version will be 2.0.50727.XX, and only the XX will change. But the version folder and registry key for the .NET Framework 2.0 does not use the XX part of the version, so the detection code will continue to work on the final release of .NET 2.0.

  4. I’ve received a few questions recently about how to programmatically detect whether or not the .NET Framework

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

Comments are closed.

Skip to main content