cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
grills
Level 3

Checking Prerequisites on upgrade via InstallScript project

I have a multi instance InstallScript project and am having trouble getting it to install prerequisites upon upgrade.

A little background is that a new version of our application now requires .NET 3.5 instead of .NET 2.0. (Although the issue is for any newly added prequisite).

If I select to install a new instance, I get the dialog listing the prerequites. But if I select an instance from the list to be upgraded, all I get is the dialog to kick off the upgrade.

Am I missing something?

Thanks

Mark
Labels (1)
0 Kudos
(1) Reply
ZygoCorp
Level 6

This is a known issue - well, known AFTER I brought it to Acresso's attention.....reference the issue number is IOB-000058418. I really can't believe acresso didn't find this one in SQA.

Our issue was version A required .Net 2.0 and version B (next release) required .Net 3.5 SP1. Clean installs worked great. Upgrades did not. I've had to manually add checking for and installing .Net 3.5 SP1 in OnMoving(). But also, I felt it important to give the user the option to NOT install the prerequisite, in which case our installer ends. Here is the code. Note that I created an empty component and Feature for use by this. Another caveat is that by On Moving(), installshield has added the new version number to the registry, so if the user chooses NOT to install the prereq I have to go and get rid of the version entry, otherwise the next run think the new version in installed....It was a PAIN. Good luck.

//---------------------------------------------------------------------------
// 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 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;

//---------------------------------------------------------------------------
// 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 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();
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 InstallDotNet3_5SP1().", szBaseRegInstallKey + "\\" + szKeyName);
nResult = WriteLine(glLogFile, szMessage);
//MessageBox(szMessage, INFORMATION);
else
Sprintf(szMessage, "Successfully set registry entry %s in InstallDotNet3_5SP1().", szBaseRegInstallKey + "\\" + szKeyName);
nResult = WriteLine(glLogFile, szMessage);
//MessageBox(szMessage, INFORMATION);
endif;
RegDBSetDefaultRoot(HKEY_CLASSES_ROOT);
SdShowMsg(szMessage, FALSE);
endif;
end;

//---------------------------------------------------------------------------
// AskInstallDotNet3_5SP1
//
// Ask user if they want to install .NET 3.5 SP1.
// It is up to the calling routine to act appropriately based onthe customer's choice.
//
// Returns TRUE if user selects to install .NET 3.5 SP1
// FALSE if user selects NOT to install .NET 3.5 SP; this will abort the installation
//
// Called by: CheckForDotNet3_5SP1()
//---------------------------------------------------------------------------
function AskInstallDotNet3_5SP1()
STRING szMessage, szExeCmd, szCmdLine;
NUMBER nResult;
begin
nResult = YES;
Sprintf(szMessage, ".Net 3.5 SP1 is a prerequisite for %s v%s.\nInstall .Net 3.5 SP1 now? (Selecting 'no' will abort the installation.)", IFX_PRODUCT_NAME, IFX_PRODUCT_VERSION);
nResult = AskYesNo(szMessage, YES);
return nResult;
end;
0 Kudos