I need some help understanding the logic behind the uninstall operation in IA. Here's my code:
Code: Select all
[DEFINE REGION: Perform an UnInstallation]
if Variable REMOVE Equals TRUE
Comment: Uninstall product
Comment: TO-DO: Insert any additional uninstall commands here
Set Variable PROGRESSTEXT to Un-Installing $TITLE$
Set Variable TD to
Set Variable TDD to $TARGETDIR$\nonexist.exe
Replace \\ with \: TDD
Extract File Folder: TDD
Parse String $TDD$ into Variables TD and (Split at last occurrence of pattern)
Set Variable DD to
if Variable MCDATADIR Equals
Set Variable MCDATADIR to $MCSharedDataDirectory$
end
Set Variable DDD to $MCDATADIR$\nonexist.exe
Replace \\ with \: DDD
Extract File Folder: DDD
Parse String $DDD$ into Variables DD and (Split at last occurrence of pattern)
Set Variable isAbyssWebServerInstalled to
Check Service State for AbyssWebServer (write result into variable isAbyssWebServerInstalled)
if Variable isAbyssWebServerInstalled not Equals (Ignore Case) NOTINSTALLED
Write into Text File $LOGGED$ from Value executing MCAbyssInstaller.exe -u -t"$TD$" -c$MCComputerRole$ -d"$DD$" (at end of file)
Run Program $SUPPORTDIR$\MCAbyssInstaller.exe -u -t"$TD$" -c$MCComputerRole$ -d"$DD$", startup in folder $TARGETDIR$ (WAIT)
end
Set Variable isMCServiceInstalled to
Check Service State for MCService (write result into variable isMCServiceInstalled)
if Variable isMCServiceInstalled not Equals NOTINSTALLED
Write into Text File $LOGGED$ from Value executing MCServiceInstaller.exe -u -t"$TD$" -c$MCComputerRole$ (at end of file)
Run Program $SUPPORTDIR$\MCServiceInstaller.exe -u -t"$TD$" -c$MCComputerRole$, startup in folder $TARGETDIR$ (WAIT)
end
Set Variable isMCMServiceInstalled to
Check Service State for MCMService (write result into variable isMCMServiceInstalled)
if Variable isMCMServiceInstalled not Equals NOTINSTALLED
Write into Text File $LOGGED$ from Value executing MCMServiceInstaller.exe -u -t"$TD$" -c$MCComputerRole$ (at end of file)
Run Program $SUPPORTDIR$\MCMServiceInstaller.exe -u -t"$TD$" -c$MCComputerRole$, startup in folder $TARGETDIR$ (WAIT)
end
Unregister assembly Microsoft.ServiceBus, Version=0.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Apply Uninstall (get result into variable SUCCESS)
if Variable SUCCESS not Equals ERROR
if Variable SUCCESS not Equals CANCEL
Remove Unpinned Assemblies
if Variable IsWindows64Bit Equals (Ignore Case) TRUE
Run Program $SUPPORTDIR$\gacutilx64.exe /ul $SUPPORTDIR$\GAC.txt (WAIT)
else
Run Program $SUPPORTDIR$\gacutilx32.exe /ul $SUPPORTDIR$\GAC.txt (WAIT)
end
end
end
Set Variable PROGRESS to 100
Comment: Next 3 lines seem to be required
Comment: Hide Dialog
Comment: Display Dialog: finish, wait for dialog to return (modal)
Comment: Terminate Installation
end
<<Code Folding Region>>
Everything proceeds as expected and as I understand it, the uninstall process is completed within that region. The uninstallation appears to work OK BUT unfortunately, my installation appears to then proceed with the installation routine and fails of course. Here's the rest of my script (edited to remove repetitive calls):
Code: Select all
[DEFINE REGION: Perform First Time or Maintenance Installation]
Comment: Install/Re-Install product
Create Shortcut $SHORTCUTFOLDER$\Uninstall MyCourts to $UNINSTALLLINK$, run as administrator, do not highlight in Start Menu, do not include in Start Screen, disable user pinning
[OFFLINE CONTENT]
label: Registry entries
Comment: ########### Registry
Set Variable PROGRESSTEXT to Checking Registry Entries
Set Variable PROGRESSMODE to MARQUEE
Set Variable HKLMExists to FALSE
Check Registry Key HKLM\SOFTWARE\Aquarius Communications\MyCourts\ into HKLMExists
if Variable HKLMExists Equals NO$KEY
Write Registry Key HKLM\SOFTWARE\Aquarius Communications\MyCourts\, (permanent)
end
Comment: Record the location of the Shared Resources Directory
if Variable MCSharedDataDirectory not Equals
Set Variable MCDATADIR to $MCSharedDataDirectory$
Set Variable MCDD to $MCDATADIR$\somenonexistsnat.exe
Replace \\ with \: MCDD
Extract File Folder: MCDD
Parse String $MCDD$ into Variables MCDATADIR and (Split at last occurrence of pattern)
Write Registry Key HKLM\SOFTWARE\Aquarius Communications\MyCourts\SharedDataDirectory, $MCDATADIR$ (permanent)
else
Comment: $ALLAPPDATA$ has a trailing backslash
Set Variable MCDATADIR to $ALLAPPDATA$Aquarius Communications\MyCourts\Resources
Set Variable MCDD to $MCDATADIR$\somenonexistsnat.exe
Replace \\ with \: MCDD
Extract File Folder: MCDD
Parse String $MCDD$ into Variables MCDATADIR and (Split at last occurrence of pattern)
Write Registry Key HKLM\SOFTWARE\Aquarius Communications\MyCourts\SharedDataDirectory, $MCDATADIR$ (permanent)
end
Comment: Record the location of the Local Resources Directory
Write Registry Key HKLM\SOFTWARE\Aquarius Communications\MyCourts\LocalDataDirectory, $ALLAPPDATA$Aquarius Communications\MyCourts\Resources (permanent)
Comment: Record the location of the Data Directory [Will replaced SharedDataDirectory]
Write Registry Key HKLM\SOFTWARE\Aquarius Communications\MyCourts\DataDirectory, $MCDATADIR$ (permanent)
Set Variable TDD to $TARGETDIR$\somenonexistsnat.exe
Replace \\ with \: TDD
Extract File Folder: TDD
Parse String $TDD$ into Variables TARGETDIR and (Split at last occurrence of pattern)
Write Registry Key HKLM\SOFTWARE\Aquarius Communications\MyCourts\AppDirectory, $TARGETDIR$ (permanent)
Set Variable MCUseServerDB to
Check Registry Key HKLM\Software\Aquarius Communications\UserServerDB into MCUseServerDB
if Variable MCUseServerDB not Equals NO$KEY
Read Registry Key HKLM\Software\Aquarius Communications\MyCourts\UseServerDB into MCUseServerDB
else
Write Registry Key HKLM\SOFTWARE\Aquarius Communications\MyCourts\UseServerDB, True (permanent)
end
Write Registry Key HKLM\SOFTWARE\Aquarius Communications\MyCourts\ComputerRole, $MCComputerRole$ (permanent)
if Variable ALLUSERS Equals TRUE
Write Registry Key HKLM\SOFTWARE\Aquarius Communications\MyCourts\AllUsers, 1 (permanent)
end
Apply Install (get result into variable SUCCESS)
Write into Text File $LOGGED$ from Value Applly Install Line 561 returned = $SUCCESS$ (at end of file)
Set Variable CompletedPermissions to FALSE
Set Variable SetPermissionsResult to
Set Variable TDD to $TARGETDIR$\nonexist.exe
Replace \\ with \: TDD
Extract File Folder: TDD
Parse String $TDD$ into Variables TARGETDIR and (Split at last occurrence of pattern)
Run Program $SUPPORTDIR$\SetPermissions.exe "$TARGETDIR$"
Write into Text File $LOGGED$ from Value SetPermissions returned = $SetPermissionsResult$ (at end of file)
Apply Install (get result into variable CompletedPermissions)
Write into Text File $LOGGED$ from Value Applly Install Line 572 returned = $SUCCESS$ (at end of file)
Write into Text File $LOGGED$ from Value SetPermissions returned $CompletedPermissions$ (at end of file)
Set Variable PROGRESSTEXT to Installing $TITLE$ Program files.
Write into Text File $LOGGED$ from Value Install Files: TARGETDIR = $TARGETDIR$ (at end of file)
Write into Text File $LOGGED$ from Value Install Files: MCDATADIR = $MCDATADIR$ (at end of file)
Install Files D:\IADistributions\MyCourts\help.ico to $TARGETDIR$
Install Files D:\IADistributions\MyCourts\subinacl.exe to $TARGETDIR$
Set Variable PROGRESSTEXT to Creating Shortcuts
label: Create Shortcuts
Create Shortcut $SHORTCUTFOLDER$\MyCourts to $TARGETDIR$\MyCourts.exe
Create Shortcut $SHORTCUTFOLDER$\MyCourts Help to $TARGETDIR$\MyCourts.chm, Pin to Start Screen
Create Shortcut $SHORTCUTFOLDER$\MyCourts Reports to $TARGETDIR$\MyCourtsReports.exe
Create Shortcut $SHORTCUTFOLDER$\MyCourts Manager to $TARGETDIR$\MCManager.exe, Pin to Start Menu, Pin to Start Screen
Create Shortcut $DESKTOPDIR$\MyCourts Manager to $TARGETDIR$\MCManager.exe, Pin to Start Menu, Pin to Start Screen
Create Shortcut $SHORTCUTFOLDER$\MyCourts Check for Updates to $TARGETDIR$\MCCheckForUpdates.exe, run as administrator
if Variable Client not Equals (Ignore Case) TRUE
Create Shortcut $SHORTCUTFOLDER$\MyCourts Administrator to $TARGETDIR$\MyCourtsAdmin.exe, run as administrator
Create Shortcut $SHORTCUTFOLDER$\MyCourts Support to $TARGETDIR$\MCSupport.exe
end
if Variable Client not Equals (Ignore Case) TRUE
Set Variable PROGRESSTEXT to Installing $TITLE$ Database Files
Install Files D:\IADistributions\MyCourts\chimes.wav to $MCDATADIR$
Install Files D:\IADistributions\MyCourts\MyCourtsUserLog.vdb4 to $MCDATADIR$ (Permanent, Never Overwrite)
end
Write Registry Key HKLM\SYSTEM\CurrentControlSet\services\MCService\AppDirectory, $TARGETDIR$
Write Registry Key HKLM\SYSTEM\CurrentControlSet\services\MCService\ComputerRole, $MCComputerRole$
Write Registry Key HKLM\SYSTEM\CurrentControlSet\services\MCService\LocalDataDirectory, $ALLAPPDATA$Aquarius Communications\MyCourts\ResourcesWrite Registry Key HKLM\SYSTEM\CurrentControlSet\services\MCService\DBPath, $MCDATADIR$
Write Registry Key HKLM\SYSTEM\CurrentControlSet\services\MCMService\AppDirectory, $TARGETDIR$
Write Registry Key HKLM\SYSTEM\CurrentControlSet\services\MCMService\ComputerRole, $MCComputerRole$
Write Registry Key HKLM\SYSTEM\CurrentControlSet\services\MCMService\LocalDataDirectory, $ALLAPPDATA$Aquarius Communications\MyCourts\ResourcesWrite Registry Key HKLM\SYSTEM\CurrentControlSet\services\MCMService\DBPath, $MCDATADIR$
Install Files D:\IADistributions\MyCourts\MCUpdateClient.exe.config to $TARGETDIR$
Install Files D:\IADistributions\MyCourts\ShowHelp.exe to $TARGETDIR$
[DEFINE WEB MEDIA Language Files, Exclude from Build]
Get Component Language Files Selection State into Variable SELECTED
if Variable SELECTED Equals TRUE
end
[DEFINE WEB MEDIA POS for .Net, Exclude from Build]
Get Component POS for .Net Selection State into Variable SELECTED
if Variable SELECTED Equals TRUE
end
[DEFINE WEB MEDIA New Feature, Exclude from Build]
if Variable SELECTED Equals TRUE
end
[OFFLINE CONTENT]
Get Component MyCourts Selection State into Variable SELECTED
if Variable SELECTED Equals TRUE
end
Comment: TO-DO: Insert any additional install commands here
[compiler if Variable BUILDMODE Equals PATCH]
Apply Patch (get result into variable SUCCESS)
[compiler else]
if Variable ADVERTISE Equals TRUE
Apply Advertised (get result into variable SUCCESS)
else
Create Folder $TARGETDIR$\webserver
Create Folder $TARGETDIR$\webserver\htdocs
Create Folder $TARGETDIR$\bin
Comment: Set Variable CommonDocuments to
Comment: Read Registry Key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Folders\Common Documents into CommonDocuments
Comment: Create Folder $CommonDocuments$\MyCourts
if Variable Client not Equals (Ignore Case) TRUE
Set Variable PROGRESSTEXT to Installing $TITLE$ Database files [Not advertised]
Create Folder $MCDATADIR$\MemberNotes
Create Folder $MCDATADIR$\Semaphores
Write into Text File $MCDATADIR$\Semaphores\alertCloseDBConnections.sema4 from Value Installation in progress (at end of file)
end
Set Variable PROGRESSTEXT to Installing $TITLE$ Assemblies
Install Assembly D:\IADistributions\MyCourts\DLL's\nsoftware.IPWorks.dll to Global Assembly Cache
Install Assembly D:\IADistributions\MyCourts\DLL's\MCWCFService.dll to Global Assembly Cache
Set Variable PROGRESSTEXT to Installing files
Comment: Apply Install
Apply Install (get result into variable SUCCESS)
Set Variable PROGRESSTEXT to Installing services
Set Variable TD to
Set Variable TDD to $TARGETDIR$\nonexist.exe
Replace \\ with \: TDD
Comment: Write into Text File $LOGGED$ from Value TDD = $TDD$ (at end of file)
Extract File Folder: TDD
Comment: Write into Text File $LOGGED$ from Value TDD = $TDD$ (at end of file)
Parse String $TDD$ into Variables TD and (Split at last occurrence of pattern)
Write into Text File $LOGGED$ from Value TDD = $TDD$ and hence TD = $TD$ (at end of file)
Set Variable DD to
Set Variable DDD to $MCDATADIR$\Noexist.exe
Replace \\ with \: DDD
Extract File Folder: DDD
Parse String $DDD$ into Variables DD and (Split at last occurrence of pattern)
Comment: MessageBox: Debug, running MCInstallUtility
Write into Text File $LOGGED$ from Value executing MCInstallUtility.exe -i -t"$TD$" -c$MCComputerRole$ -d"$DD$" (at end of file)
Run Program $SUPPORTDIR$\MCInstallUtility.exe -i -t"$TD$" -c$MCComputerRole$ -d"$DD$", startup in folder $TD$ (WAIT)
if Variable Server Equals (Ignore Case) TRUE
Set Variable SmartInspectRouter to
Check Service State for SmartInspectRouter (write result into variable SmartInspectRouter)
if Variable SmartInspectRouter not Equals (Ignore Case) NOTINSTALLED
Set Variable PROGRESSTEXT to Start SmartInspect Router
if Variable SmartInspectRouter Equals STOPPED
Run Program net start SmartInspectRouter (WAIT)
end
end
end
if Variable Client not Equals (Ignore Case) TRUE
Does File Exist $TARGETDIR$\MCService.exe (get result into variable MCServiceExists)
Write into Text File $LOGGED$ from Value MCService.exe exists = $MCServiceExists$ (at end of file)
Write into Text File $LOGGED$ from Value executing MCServiceInstaller.exe -i -t"$TD$" -c$MCComputerRole$ (at end of file)
Run Program $SUPPORTDIR$\MCServiceInstaller.exe -i -t"$TD$" -c$MCComputerRole$, startup in folder $TARGETDIR$ (WAIT)
Set Variable MCServiceState to
Check Service State for MCService (write result into variable MCServiceState)
if Variable MCServiceState not Equals (Ignore Case) NOTINSTALLED
Set Variable PROGRESSTEXT to Start MCService
if Variable MCServiceState Equals STOPPED
Run Program net start MCService (WAIT)
end
end
Write into Text File $LOGGED$ from Value executing MCMServiceInstaller.exe -i -t"$TD$" -c$MCComputerRole$ (at end of file)
Run Program $SUPPORTDIR$\MCMServiceInstaller.exe -i -t"$TD$" -c$MCComputerRole$, startup in folder $TARGETDIR$ (WAIT)
Set Variable MCMServiceState to
Check Service State for MCMService (write result into variable MCMServiceState)
if Variable MCMServiceState not Equals (Ignore Case) NOTINSTALLED
Set Variable PROGRESSTEXT to Start MCMService
if Variable MCMServiceState Equals STOPPED
Run Program net start MCMService (WAIT)
end
end
Write into Text File $LOGGED$ from Value executing MCAbyssInstaller.exe -i -t"$TD$" -c$MCComputerRole$ -d"$DD$" (at end of file)
Run Program $SUPPORTDIR$\MCAbyssInstaller.exe -i -t"$TD$" -c$MCComputerRole$ -d"$DD$", startup in folder $TARGETDIR$ (WAIT)
Set Variable MCAbyssState to
Check Service State for AbyssWebServer (write result into variable MCAbyssState)
if Variable MCAbyssState not Equals (Ignore Case) NOTINSTALLED
Set Variable PROGRESSTEXT to Start Abyss Web Server
if Variable MCAbyssState Equals STOPPED
Run Program net start AbyssWebServer (WAIT)
end
end
end
if Variable REMOVE Equals FALSE
if Variable Client not Equals (Ignore Case) TRUE
Set Variable PROGRESSTEXT to Checking / Updating database
Run Program $TARGETDIR$\MyCourtsUpdate.exe , startup in folder $TARGETDIR$ (WAIT)
Does File Exist $MCDATADIR$\Semaphores\alertCloseDBConnections.sema4 (get result into variable FileExists)
if Variable FileExists Equals (Ignore Case) TRUE
Delete Files $MCDATADIR$\Semaphores\alertCloseDBConnections.sema4 (when installing and uninstalling)
end
end
end
if Variable SUCCESS not Equals ERROR
if Variable SUCCESS not Equals CANCEL
Comment: Grant Complete Access to File System Object "$ALLAPPDATA$\Aquarius Communications\MyCourts\Resources\*.*"
Comment: Grant Complete Access to File System Object "$MCDATADIR$"
Register assembly Microsoft.ServiceBus, Version=0.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Comment: Grant Complete Access to Registry Key "HKEY_LOCAL_MACHINE\SOFTWARE\Aquarius Communications\MyCourts"
Comment: Grant Complete Access to File System Object "$TARGETDIR$"
end
Set Variable PROGRESSTEXT to Updating firewall rules
Set Variable UserOSVersion to
Get Exact OS Level into UserOSVersion
if Variable UserOSVersion Equals XP
Run Program netsh firewall delete allowedprogram "$TARGETDIR$\MyCourtsAdmin.exe"
Run Program netsh firewall add allowedprogram"$TARGETDIR$\MyCourtsAdmin.exe" "MyCourts Administrator" ENABLE
Run Program netsh firewall delete allowedprogram "$TARGETDIR$\MyCourts.exe"
Run Program netsh firewall add allowedprogram"$TARGETDIR$\MyCourts.exe" "MyCourts" ENABLE
Comment: Run Program netsh firewall delete allowedprogram "$TargetDir$\MCService.exe"
Comment: Run Program netsh firewall add allowedprogram"$TargetDir$\MCService.exe" "MCService" ENABLE
Comment: if Variable Client not Equals (Ignore Case) TRUE
Comment: Run Program netsh firewall add allowedprogram"$TargetDir$\webserver\abyssws.exe ENABLE
Comment: end
else
Run Program netsh advfirewall firewall delete rule name="MyCourts Administrator" program="$TARGETDIR$\MyCourtsAdmin.exe"
Run Program netsh advfirewall firewall add rule name="MyCourts Administrator" dir=out action=allow program="$TARGETDIR$\MyCourtsAdmin.exe" enable=yes
Run Program netsh advfirewall firewall delete rule name="MyCourts" program="$TARGETDIR$\MyCourts.exe"
Run Program netsh advfirewall firewall add rule name=MyCourts dir=out action=allow program="$TARGETDIR$\MyCourts.exe" enable=yes
Comment: Run Program netsh advfirewall firewall delete rule name="MCService" program="$TargetDir$\MCService.exe"
Comment: Run Program netsh advfirewall firewall add rule name=MCService dir=out action=allow program="$TargetDir$\MCService.exe" enable=yes
Comment: if Variable Client not Equals (Ignore Case) TRUE
Comment: Run Program netsh advfirewall firewall add rule name=AbyssWebServer dir=out action=allow program="$TargetDir$\webserver\abyssws.exe" enable=yes
Comment: end
end
end
end
[compiler end]
Set Variable PROGRESS to 100
Comment: end
<<Code Folding Region>>
<<Code Folding Region>>
[DEFINE REGION: Finish Setup]
Comment: End of Installation
Set Variable runMCManager to False
Hide Dialog
Display Dialog: finish, wait for dialog to return (modal)
if Variable SILENT Equals FALSE
if Variable REBOOTCOMPUTER Equals TRUE
if Variable SUCCESS Equals REBOOT
Reboot Computer
end
end
Comment: TO-DO: Insert command that starts your application here
if Variable REMOVE Equals FALSE
if Variable SUCCESS Equals COMPLETE
Run Program $EXEFILE$ /updatesetup /s
Comment: Run Program hh.exe mk:@MSITStore:$TARGETDIR$\MyCourts.chm::/MCManager.htm
Comment: Run Program $TARGETDIR$\MCManager.exe -i
Run Program ShowHelp.exe , startup in folder $TARGETDIR$
end
end
end
<<Code Folding Region>>
It seems to me that:
Comment: Next 3 lines seem to be required
Comment: Hide Dialog
Comment: Display Dialog: finish, wait for dialog to return (modal)
Comment: Terminate Installation
should be commented in but I've looked at the samples supplied with the distribution and they don't have any such directives.
I'm using the Native Engine if that matters.
Thanks.