I have a installation package made using the Wix toolset, that includes a service created with Embarcadero's C++ Builder. ECB has a different syntax to register/unregister services under Windows if compared to Visual Studio C++/C#, I was not able to register the service through the regular Wix element <ServiceInstall>
, the installer freezes during the service registration/unregistration.
I found a solution through the Wix Custom Actions
. I created the following actions:
<CustomAction
Id="LaunchApp_SrvInstall"
Directory="INSTALLDIR"
Impersonate="no"
Execute="deferred"
ExeCommand=""[INSTALLDIR]ACService.exe" /install /silent">
</CustomAction>
<CustomAction
Id="LaunchApp_SrvUninstall"
Directory="INSTALLDIR"
Impersonate="no"
Execute="deferred"
ExeCommand=""[INSTALLDIR]ACService.exe" /uninstall /silent">
</CustomAction>
<InstallExecuteSequence>
<Custom Action="LaunchApp_SrvInstall" After="InstallFiles">NOT REMOVE</Custom>
<Custom Action="LaunchApp_SrvUninstall" Before="RemoveFiles">REMOVE ~= "ALL"</Custom>
</InstallExecuteSequence>
With the syntax above, during the package install, after the files are copied to the installation directory I have the service registered, and if I'm uninstalling the package the service is unregistered before the installed files are removed. In both cases it works perfectly. The problem I'm facing happens when I try to update the software to a newer version, I have the scenario where the software and the service are running and the user tries to install the new MSI package to update the entire solution. In that case, I have the following popup:
It seems that during the update process, the installer is trying to register the service twice, but I can't figure why. Does anyone here already faced such situation? Is there a way to configure the Custom Actions to work also during the package update?