There is information in the Microsoft .NET Framework 3.0 deployment guide that describes how to read registry values to detect whether or not the .NET Framework 3.0 is installed on a system. I just noticed a subtle point that I wanted to clarify in case anyone else runs into it as well. We document the following registry value to use to detect the presense of the .NET Framework 3.0:
- Registry root: HKEY_LOCAL_MACHINE
- Key name: SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup
- Value name: InstallSuccess
- Value data type: REG_DWORD
- Value data: 1
However, if you go and look for this value in regedit.exe on a 64-bit OS that has the .NET Framework 3.0 installed, you will not see it. On a 64-bit OS, this detection registry value is automatically reflected by WOW64 registry redirection. This means, you will see the value under the key HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\NET Framework Setup\NDP\v3.0\Setup.
If you run a 32-bit application on a 64-bit OS, you can query the non-reflected registry value (without the Wow6432Node in the key name) and Windows will automatically redirect the registry query for you. However, if you run a native 64-bit application on a 64-bit OS, or have a 32-bit process that is hosted within a 64-bit process, you will need to use an additional flag (KEY_WOW64_32KEY) when calling registry APIs to ensure that the 64-bit process can access the 32-bit registry view so that it will be able to find this .NET Framework 3.0 detection registry value.
More information about Windows registry APIs for WOW64 scenarios can be found in the following topics on the MSDN web site: