This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- .NET 3.5 SP1 with InstallScript
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 18, 2009
04:51 AM
.NET 3.5 SP1 with InstallScript
Hello.
In our company we use the InstallScript (not InstallScript MSI Project) technology for our setups. Now we have to setup a new setup for our next geneneration Software. This software needs .NET 3.5 SP1.
I didn't find any option to check for .NET or better to install .NET. In any other setuptype this can be done by "Redistributables". Is there any way to do it in plain InstallScript Projects ? If not, how different is the paradigm for InstallScript MSI Projects ?
Guido
In our company we use the InstallScript (not InstallScript MSI Project) technology for our setups. Now we have to setup a new setup for our next geneneration Software. This software needs .NET 3.5 SP1.
I didn't find any option to check for .NET or better to install .NET. In any other setuptype this can be done by "Redistributables". Is there any way to do it in plain InstallScript Projects ? If not, how different is the paradigm for InstallScript MSI Projects ?
Guido
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 18, 2009
12:57 PM
I believe the Is() function has support for checking installed versions of .NET, and LaunchApplication() can certainly run Microsoft's .NET redistributables. I'm not aware of any pure InstallScript pre-built options for .NET 3.5 SP1 at this time.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 24, 2009
02:37 PM
Here's what we did since InstallShield does not handle checking and installing prerequisites for updates (v1 required .net 2.0, v2 requires .net 3.5); it only handles for new installs. Indenting is probably messed up,,,
and these are functions we found we needed. IS adds the iversion registry entry after OnMoveData(), and if you abort the install here (we called these from OnMoving(), the next execution thinks this version was already installed, when infact it hadn't) DeleteRegistryVersionAfterAbort();
and we wrote a routine to ask if the user wanted this prereq installed:
AskInstallDotNet3_5SP1();
//------------------------------------------------------------------------
// CheckForDotNet3_5SP1
//
// Determine if .NET 3.5 SP1 is installed.
// If it is, do nothing
// If it is NOT, then flag the feature DotNet3.5SP1 for installation
//
// This is only called for Maintenance installations; it seems that IS2010
// handles this correctly for new installs but not update, modify, or repair
// installs
//
// Returns 0 always
//
// Called by: OnMoving()
//---------------------------------------------------------------------------
function CheckForDotNet3_5SP1()
STRING szMessage, szBaseRegInstallKey, szKeyName, szSvcPk;
NUMBER nResult, nType, nSize;
begin
// Set to FALSE just to be sure
nResult = FeatureSelectItem(MEDIA, "DotNet3.5SP1", FALSE);
nResult = WriteLine(glLogFile, "Establishing .Net 3.5 SP1 prerequisite.");
nResult = Is(DOTNETFRAMEWORKINSTALLED, REGDB_KEYPATH_DOTNET_35);
if (nResult = TRUE) then
Sprintf(szMessage, ".NET 3.5 is installed.");
nResult = WriteLine(glLogFile, szMessage);
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
//szBaseRegInstallKey = "\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v3.5";
szBaseRegInstallKey = REGDB_KEYPATH_DOTNET_35;
//szKeyName = "SP";
szKeyName = REGDB_VALUENAME_SP;
// Note: DOTNETSERVICEPACKINSTALLED is not applicable to REGDB_KEYPATH_DOTNET_35
nResult = RegDBGetKeyValueEx(szBaseRegInstallKey, szKeyName, nType, szSvcPk, nSize);
if (nResult < 0) then
Sprintf(szMessage, "Unable to read registry entry %s in mpx_CheckForDotNet3_5SP1. Assuming .Net 3.5 SP1 is NOT installed.", szBaseRegInstallKey ^ szKeyName);
nResult = WriteLine(glLogFile, szMessage);
nResult = AskInstallDotNet3_5SP1();
if (nResult = TRUE) then
nResult = FeatureSelectItem(MEDIA, "DotNet3.5SP1", TRUE);
else // FALSE
Sprintf(szMessage, "User selected to NOT install .Net 3.5 SP1. Aborting the installation.");
nResult = WriteLine(glLogFile, szMessage);
DeleteRegistryVersionAfterAbort();
abort;
endif;
else
if (szSvcPk = "1") then
// life is good
Sprintf(szMessage, "SP1 for .NET 3.5 is installed.");
nResult = WriteLine(glLogFile, szMessage);
else
Sprintf(szMessage, "SP1 for .NET 3.5 is NOT installed.");
nResult = WriteLine(glLogFile, szMessage);
nResult = AskInstallDotNet3_5SP1();
if (nResult = TRUE) then
nResult = FeatureSelectItem(MEDIA, "DotNet3.5SP1", TRUE);
else // FALSE
Sprintf(szMessage, "User selected to NOT install .Net 3.5 SP1. Aborting the installation.");
nResult = WriteLine(glLogFile, szMessage);
DeleteRegistryVersionAfterAbort();
abort;
endif;
endif;
endif;
// Return registry root to default; good practice
RegDBSetDefaultRoot(HKEY_CLASSES_ROOT);
elseif (nResult = FALSE) then
Sprintf(szMessage, ".NET 3.5 is NOT installed.");
nResult = WriteLine(glLogFile, szMessage);
nResult = AskInstallDotNet3_5SP1();
if (nResult = TRUE) then
nResult = FeatureSelectItem(MEDIA, "DotNet3.5SP1", TRUE);
else // FALSE
Sprintf(szMessage, "User selected to NOT install .Net 3.5 SP1. Aborting the installation.");
nResult = WriteLine(glLogFile, szMessage);
DeleteRegistryVersionAfterAbort();
abort;
endif;
else
Sprintf(szMessage, "Unable to determine if .NET 3.5 is installed. Assuming .Net 3.5 SP1 is NOT installed.");
nResult = WriteLine(glLogFile, szMessage);
nResult = AskInstallDotNet3_5SP1();
if (nResult = TRUE) then
nResult = FeatureSelectItem(MEDIA, "DotNet3.5SP1", TRUE);
else // FALSE
Sprintf(szMessage, "User selected to NOT install .Net 3.5 SP1. Aborting the installation.");
nResult = WriteLine(glLogFile, szMessage);
DeleteRegistryVersionAfterAbort();
abort;
endif;
endif;
end;
//---------------------------------------------------------------------------
// mpx_InstallDotNet3_5SP1
//
// Actually install .NET 3.5 SP1 if it is not installed.
// This is only required for Maintenance installations; it seems that IS2010
// handles this correctly for new installs but not update, modify, or repair
// installs
//
// Returns 0 always
//
// Called by: OnMoving()
//---------------------------------------------------------------------------
function mpx_InstallDotNet3_5SP1()
STRING szMessage, szExeCmd, szCmdLine, szBaseRegInstallKey, szKeyName;
NUMBER nResult;
begin
if (FeatureIsItemSelected(MEDIA, "DotNet3.5SP1")) then
Sprintf(szMessage, "Installing .Net 3.5 SP1 prerequisite.");
nResult = WriteLine(glLogFile, szMessage);
SdShowMsg(szMessage, TRUE);
// Install .Net 3.5 SP1
szExeCmd = SUPPORTDIR ^ "Helper.exe";
szCmdLine = "/p dotnetfx35.exe /l 1033 /v \"/q /norestart\"";
Sprintf(szMessage, "Calling: %s %s.", szExeCmd, szCmdLine);
nResult = WriteLine(glLogFile, szMessage);
nResult = LaunchAppAndWait(szExeCmd, szCmdLine, LAAW_OPTION_WAIT);
if (nResult < 0) then
SdShowMsg(szMessage, FALSE);
Sprintf(szMessage, "Could not execute %s %s.\nAborting the installation.", szExeCmd, szCmdLine);
nResult = WriteLine(glLogFile, szMessage);
MessageBox(szMessage, SEVERE);
DeleteRegistryVersionAfterAbort();
Cleanup();
abort;
endif;
// Write registry entry that this was actually executed
// Testing for FeatureIsItemSelected seems to always return TRUE in the OnAbort() method
// Therefore, will change test to look for this registry key
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
szBaseRegInstallKey = "\\SOFTWARE\\Zygo Corporation\\Install Data\\MPX";
szKeyName = "InstalledDotNet35SP1";
nResult = RegDBSetKeyValueEx(szBaseRegInstallKey, szKeyName, REGDB_STRING, "1", -1);
if (nResult < 0) then
Sprintf(szMessage, "Unable to set registry entry %s in mpx_InstallDotNet3_5SP1().", szBaseRegInstallKey + "\\" + szKeyName);
nResult = WriteLine(glLogFile, szMessage);
//MessageBox(szMessage, INFORMATION);
else
Sprintf(szMessage, "Successfully set registry entry %s in mpx_InstallDotNet3_5SP1().", szBaseRegInstallKey + "\\" + szKeyName);
nResult = WriteLine(glLogFile, szMessage);
//MessageBox(szMessage, INFORMATION);
endif;
RegDBSetDefaultRoot(HKEY_CLASSES_ROOT);
SdShowMsg(szMessage, FALSE);
endif;
end;
and these are functions we found we needed. IS adds the iversion registry entry after OnMoveData(), and if you abort the install here (we called these from OnMoving(), the next execution thinks this version was already installed, when infact it hadn't) DeleteRegistryVersionAfterAbort();
and we wrote a routine to ask if the user wanted this prereq installed:
AskInstallDotNet3_5SP1();
//------------------------------------------------------------------------
// CheckForDotNet3_5SP1
//
// Determine if .NET 3.5 SP1 is installed.
// If it is, do nothing
// If it is NOT, then flag the feature DotNet3.5SP1 for installation
//
// This is only called for Maintenance installations; it seems that IS2010
// handles this correctly for new installs but not update, modify, or repair
// installs
//
// Returns 0 always
//
// Called by: OnMoving()
//---------------------------------------------------------------------------
function CheckForDotNet3_5SP1()
STRING szMessage, szBaseRegInstallKey, szKeyName, szSvcPk;
NUMBER nResult, nType, nSize;
begin
// Set to FALSE just to be sure
nResult = FeatureSelectItem(MEDIA, "DotNet3.5SP1", FALSE);
nResult = WriteLine(glLogFile, "Establishing .Net 3.5 SP1 prerequisite.");
nResult = Is(DOTNETFRAMEWORKINSTALLED, REGDB_KEYPATH_DOTNET_35);
if (nResult = TRUE) then
Sprintf(szMessage, ".NET 3.5 is installed.");
nResult = WriteLine(glLogFile, szMessage);
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
//szBaseRegInstallKey = "\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v3.5";
szBaseRegInstallKey = REGDB_KEYPATH_DOTNET_35;
//szKeyName = "SP";
szKeyName = REGDB_VALUENAME_SP;
// Note: DOTNETSERVICEPACKINSTALLED is not applicable to REGDB_KEYPATH_DOTNET_35
nResult = RegDBGetKeyValueEx(szBaseRegInstallKey, szKeyName, nType, szSvcPk, nSize);
if (nResult < 0) then
Sprintf(szMessage, "Unable to read registry entry %s in mpx_CheckForDotNet3_5SP1. Assuming .Net 3.5 SP1 is NOT installed.", szBaseRegInstallKey ^ szKeyName);
nResult = WriteLine(glLogFile, szMessage);
nResult = AskInstallDotNet3_5SP1();
if (nResult = TRUE) then
nResult = FeatureSelectItem(MEDIA, "DotNet3.5SP1", TRUE);
else // FALSE
Sprintf(szMessage, "User selected to NOT install .Net 3.5 SP1. Aborting the installation.");
nResult = WriteLine(glLogFile, szMessage);
DeleteRegistryVersionAfterAbort();
abort;
endif;
else
if (szSvcPk = "1") then
// life is good
Sprintf(szMessage, "SP1 for .NET 3.5 is installed.");
nResult = WriteLine(glLogFile, szMessage);
else
Sprintf(szMessage, "SP1 for .NET 3.5 is NOT installed.");
nResult = WriteLine(glLogFile, szMessage);
nResult = AskInstallDotNet3_5SP1();
if (nResult = TRUE) then
nResult = FeatureSelectItem(MEDIA, "DotNet3.5SP1", TRUE);
else // FALSE
Sprintf(szMessage, "User selected to NOT install .Net 3.5 SP1. Aborting the installation.");
nResult = WriteLine(glLogFile, szMessage);
DeleteRegistryVersionAfterAbort();
abort;
endif;
endif;
endif;
// Return registry root to default; good practice
RegDBSetDefaultRoot(HKEY_CLASSES_ROOT);
elseif (nResult = FALSE) then
Sprintf(szMessage, ".NET 3.5 is NOT installed.");
nResult = WriteLine(glLogFile, szMessage);
nResult = AskInstallDotNet3_5SP1();
if (nResult = TRUE) then
nResult = FeatureSelectItem(MEDIA, "DotNet3.5SP1", TRUE);
else // FALSE
Sprintf(szMessage, "User selected to NOT install .Net 3.5 SP1. Aborting the installation.");
nResult = WriteLine(glLogFile, szMessage);
DeleteRegistryVersionAfterAbort();
abort;
endif;
else
Sprintf(szMessage, "Unable to determine if .NET 3.5 is installed. Assuming .Net 3.5 SP1 is NOT installed.");
nResult = WriteLine(glLogFile, szMessage);
nResult = AskInstallDotNet3_5SP1();
if (nResult = TRUE) then
nResult = FeatureSelectItem(MEDIA, "DotNet3.5SP1", TRUE);
else // FALSE
Sprintf(szMessage, "User selected to NOT install .Net 3.5 SP1. Aborting the installation.");
nResult = WriteLine(glLogFile, szMessage);
DeleteRegistryVersionAfterAbort();
abort;
endif;
endif;
end;
//---------------------------------------------------------------------------
// mpx_InstallDotNet3_5SP1
//
// Actually install .NET 3.5 SP1 if it is not installed.
// This is only required for Maintenance installations; it seems that IS2010
// handles this correctly for new installs but not update, modify, or repair
// installs
//
// Returns 0 always
//
// Called by: OnMoving()
//---------------------------------------------------------------------------
function mpx_InstallDotNet3_5SP1()
STRING szMessage, szExeCmd, szCmdLine, szBaseRegInstallKey, szKeyName;
NUMBER nResult;
begin
if (FeatureIsItemSelected(MEDIA, "DotNet3.5SP1")) then
Sprintf(szMessage, "Installing .Net 3.5 SP1 prerequisite.");
nResult = WriteLine(glLogFile, szMessage);
SdShowMsg(szMessage, TRUE);
// Install .Net 3.5 SP1
szExeCmd = SUPPORTDIR ^ "Helper.exe";
szCmdLine = "/p dotnetfx35.exe /l 1033 /v \"/q /norestart\"";
Sprintf(szMessage, "Calling: %s %s.", szExeCmd, szCmdLine);
nResult = WriteLine(glLogFile, szMessage);
nResult = LaunchAppAndWait(szExeCmd, szCmdLine, LAAW_OPTION_WAIT);
if (nResult < 0) then
SdShowMsg(szMessage, FALSE);
Sprintf(szMessage, "Could not execute %s %s.\nAborting the installation.", szExeCmd, szCmdLine);
nResult = WriteLine(glLogFile, szMessage);
MessageBox(szMessage, SEVERE);
DeleteRegistryVersionAfterAbort();
Cleanup();
abort;
endif;
// Write registry entry that this was actually executed
// Testing for FeatureIsItemSelected seems to always return TRUE in the OnAbort() method
// Therefore, will change test to look for this registry key
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
szBaseRegInstallKey = "\\SOFTWARE\\Zygo Corporation\\Install Data\\MPX";
szKeyName = "InstalledDotNet35SP1";
nResult = RegDBSetKeyValueEx(szBaseRegInstallKey, szKeyName, REGDB_STRING, "1", -1);
if (nResult < 0) then
Sprintf(szMessage, "Unable to set registry entry %s in mpx_InstallDotNet3_5SP1().", szBaseRegInstallKey + "\\" + szKeyName);
nResult = WriteLine(glLogFile, szMessage);
//MessageBox(szMessage, INFORMATION);
else
Sprintf(szMessage, "Successfully set registry entry %s in mpx_InstallDotNet3_5SP1().", szBaseRegInstallKey + "\\" + szKeyName);
nResult = WriteLine(glLogFile, szMessage);
//MessageBox(szMessage, INFORMATION);
endif;
RegDBSetDefaultRoot(HKEY_CLASSES_ROOT);
SdShowMsg(szMessage, FALSE);
endif;
end;