Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio
All postings are provided AS IS with no warranties, and confer no rights. Additionally, views expressed herein are my own and not those of my employer, Microsoft.
I've received a few questions recently about how to programmatically detect whether or not the .NET Framework 3.0 is installed on a system. As a result, I decided to update the sample code I previously published (here and here) to include logic to detect the .NET Framework 3.0 in addition to the previous logic for .NET 1.0, 1.1 and 2.0.
Where to download the sample code
You can find the updated sample code at the following locations:
Detection logic used in the sample code
The new code that I added to the above samples to check for the presence of the .NET Framework 3.0 searches for the following registry value (as described in the .NET Framework 3.0 deployment guide):
[HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v3.0\Setup]InstallSuccess=1
Detecting pre-release builds of the .NET Framework 3.0
However, we have seen some false positives if an application only searches for this registry value because this value is set in pre-release builds of the .NET Framework 3.0 in addition to the final release version. In order to narrow down the detection even further and exclude pre-release builds, I added logic to the sample code that also looks at the following registry value:
[HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v3.0\Setup]Version
This Version value contains REG_SZ data that represents a 4-part version string of the form #.#.#####.##. The final release version of the .NET Framework 3.0 contains the following version value:
The updated sample code contains a function named CheckNetfx30BuildNumber that contains the following logic:
This additional version validation is not "officially" documented anywhere, but is useful to provide a safeguard if you would like to prevent your application from installing on a system that has a pre-release build of the .NET Framework 3.0 installed.
As always, please let me know if you have any trouble building or running these samples or incorporating them into your product setup logic.
PingBack from http://www.hilpers.com/1041895-is-net-framework-2-0-a