Archived:Using RUNREMOVE and RUNINSTALL options in SIS packages
To avoid failures during uninstallation, it is important to consider the order in which the binaries will be deleted. This is especially true when the package file contains an executable that uses the RUNREMOVE (RR) option, and the executable is dependent on DLL(s) or resource files.
Likewise, the order in which the binaries are listed in the package affects the use of the RUNINSTALL (RI) option when launching an executable with dependencies.
The binaries are deleted according to the order in which they are listed in the package (.pkg) file. This solution describes how the .pkg file should define the file entries. Consider an example where an executable (EXE1) has a dependency to a DLL (DLL1):
DLL1 EXE1, FR, RR
-> EXE fails to run during uninstallation since the DLL has already been deleted.
EXE1, FR, RR DLL1
-> All OK.
IF <statement> DLL1 ENDIF EXE1, FR, RR
-> All OK. Conditional statements are executed last, and therefore DLL1 still exists when EXE1 is run.
IF <statement> DLL1 ENDIF EXE1, FR, RI
-> EXE fails to run. Conditional statements are executed last, and DLL1 has not yet been installed when trying to launch EXE1.
Using RUNWAITEND with RUNINSTALL:
It is not recommended to use FILERUN (FR), RUNINSTALL (RI) options without the RUNWAITEND (RW) option if the launched executable is a UI application. Without the RW option, the installer proceeds immediately to display an "Installation complete" message and retakes its place as the topmost application, forcing the launched application to the background.