I would suggest that you need to close the running application as early as possible in InstallExecuteSequence and, of course, before InstallInitialize , which launches the Windows Installer transaction, which makes changes to the systems.
In addition, you must run the same ApplicationClose operation in InstallUISequence so that the application closes during the interactive transition to the installation menu. The entire InstallUISequence installation is skipped when you install silently, so you need it in InstallExecuteSequence as well.
Remember that you can accidentally trigger a rollback in a user action by returning the exit / error code code that msiexec.exe is interpreted as an error. If the completion of the user action is not critical, I will disable error checking to continue the installation. In this case, it will result in a reboot.
If you are trying to close or close the service MSI has built-in functions to handle this through ServiceControl and ServiceInstall elements ( and others ).
Stein Γ
smul
source share