Closing an application using WiX

When creating my WiX installer, I encountered a problem while trying to close the application before installing the update. Below is an example of how I am trying to do this.

<util:CloseApplication Id="CloseServe" CloseMessage="yes" Target="server.exe" ElevatedCloseMessage="yes" RebootPrompt="no"/> <InstallExecuteSequence> <Custom Action="WixCloseApplications" After="RemoveExistingProducts" /> <RemoveExistingProducts After="InstallInitialize"/> <Custom Action='LaunchApplication' After='InstallFinalize'/> <!--<Custom Action='StopServer' Before='RemoveExistingProducts'/>--> </InstallExecuteSequence> 

In this example, the application ends with closing, but the installation stops at that point and then rolls back. Could this be due to the fact that exe is deleted before trying to close it? I tried changing the sequence around so that RemoveExistingProducts executes after WixCloseApplications, but then gives me error code 2613.

+6
installer wix
source share
2 answers

You can try registering the installation and see what you can track there. Try starting the installer from the command console as follows:

 msiexec.exe /i [msi filename] /log [filepath\logfilename.log] 
+7
source share

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 ).

0
source share

All Articles