PDA

View Full Version : check for .net 3.5 sp 1



cwills
12-22-2008, 12:34 PM
I have an app that requires .net 3.5 sp 1 and was planning on just failing if they don't have it. Is there a way to make it check to see if .net 3.5 sp 1 is installed?

MichaelU
12-22-2008, 01:34 PM
There should be a registry key that reflects the SP level of .NET 3.5, and I'd expect Aaron Stebner's blog has it documented somewhere. Don't forget to consider what you want to do later when a machine has, e.g., .NET 4.0 but no .NET 3.5; ideally you'd be able to work in such a scenario.

TheTraveler
12-22-2008, 02:03 PM
You can use the "IS" function to look up the various versions of .Net Framework and what service pack is installed.

Is(DOTNETFRAMEWORKINSTALLED, DOTNETFRAMEWORKINSTALLED);

Is(DOTNETFRAMEWORKINSTALLED, DOTNETSERVICEPACKINSTALLED);

From Install Shield Help:

Additional Information
.NET Framework Version and Service Details
The following predefined constants are supported for specifying a particular version of the .NET Framework using DOTNETFRAMEWORKINSTALLED or DOTNETSERVICEPACKINSTALLED:

REGDB_KEYPATH_DOTNET_35
REGDB_KEYPATH_DOTNET_30_SP—Use this variable to detect whether the SP1 (or a later service pack) of the .NET Framework 3.0 is installed.
REGDB_KEYPATH_DOTNET_30—Use this variable to detect whether the RTM version of the .NET Framework 3.0 is installed.
REGDB_KEYPATH_DOTNET_20
REGDB_KEYPATH_DOTNET_11
REGDB_KEYPATH_DOTNET_10

Tip

Since each of these predefined constants correspond to the appropriate registry path under HKEY_LOCAL_MACHINE, you can also specify a registry path directly in szIsData for DOTNETFRAMEWORKINSTALLED or DOTNETSERVICEPACKINSTALLED.

The installation of the .NET Framework 3.0 writes the registry value InstallSuccess, with 1 as the value data, in the following registry location:

HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v3.0\Setup\

Therefore, REGDB_KEYPATH_DOTNET_30 is set to that location.

The installations of all other versions of the .NET Framework write the registry value Install with a value data of 1 in the following registry location:

HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\Version Number\

The REGDB_KEYPATH_DOTNET_35, REGDB_KEYPATH_DOTNET_20, REGDB_KEYPATH_DOTNET_11, and REGDB_KEYPATH_DOTNET_10 constants are set to the appropriate values, based on that path.

Note that the installation of the .NET Framework 3.0 SP1 also writes the registry value Install with a value data of 1 in the following registry location:

HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v3.0\

Therefore, REGDB_KEYPATH_DOTNET_30_SP is set to that location.

If you use the Is function with the DOTNETFRAMEWORKINSTALLED constant, the function automatically checks for both the Install and InstallSuccess values. If the Install or InstallSuccess value exists and its value data is set to 1, Is returns TRUE. Otherwise, Is returns FALSE.

The .NET Framework 1.0 service pack installations do not create registry values that indicate the service pack number. Therefore, if you use DOTNETSERVICEPACKINSTALLED to test for the .NET Framework 1.0, the Is function compares the version of the mscorlib.dll file in FOLDER_DOTNET_10 against known version numbers to determine the service pack:

SP3 is present if the version of mscorlib.dll is 1.0.3705.6018 or later.
SP2 is present if the version of mscorlib.dll is 1.0.3705.288 or later, but earlier than 1.0.3705.6018.
SP1 is present if the version of mscorlib.dll is 1.0.3705.209 or later, but earlier than 1.0.3705.288.
The original RTM version is present if the version of mscorlib.dll is 1.0.3705.0 or later, but earlier than 1.0.3705.209.
If you use DOTNETSERVICEPACKINSTALLED to test for any of the other .NET Framework versions, the function compares the REGDB_VALUENAME_SP value under the .NET version registry constant or path that is specified in szIsData with the service pack number that is specified in szIsData. Note that the comparison is an equal-to-or-later-than version comparison; therefore, if you specify a service pack of 2 in szIsData, the function returns true whenever service pack 2 or later is installed.

.NET Framework Language Pack Details
Version 1.1 and later of the .NET Framework includes support for language packs; version 1.0 does not. For version 1.1 and later of the .NET Framework, you can test whether a particular .NET language pack is installed through the DOTNETFRAMEWORKINSTALLED constant by specifying the appropriate .NET version constant and the locale identifier (LCID) of the language (converted to a string). Separate the .NET version constant and the LCID with the caret operator. For example, use the following syntax to test whether the German language pack for .NET Framework 1.1 is installed:

NumToStr( szLang, ISLANG_GERMAN_STANDARD );

REGDB_KEYPATH_DOTNET_11 ^ szLang;

As documented by Microsoft, the .NET Framework 1.1 supports the following LCIDs:

cwills
12-23-2008, 09:08 AM
You can use the "IS" function to look up the various versions of .Net Framework and what service pack is installed.

Is(DOTNETFRAMEWORKINSTALLED, DOTNETFRAMEWORKINSTALLED);

Is(DOTNETFRAMEWORKINSTALLED, DOTNETSERVICEPACKINSTALLED);

From Install Shield Help:

This looks like InstallScript, which is something that I don't have access to as an Express user.