I'm having a real headache with how Topshelf behaves when a WIX is updating a Service... I have looked around but I can't find a specific answer for this particular issue.
First my Custom Actions on my Product.wxs:
<InstallExecuteSequence>
<Custom Action="UpgradeService" Before="InstallFiles">(INSTALLED)</Custom>
<Custom Action="InstallService" After="InstallFiles">(NOT REMOVE)</Custom>
<Custom Action="UninstallService" Before="RemoveFiles">(NOT UPGRADINGPRODUCTCODE) AND (REMOVE~="ALL")</Custom>
</InstallExecuteSequence>
<CustomAction Id="InstallService" Directory="INSTALLFOLDER" Execute="commit" Impersonate="no" ExeCommand="cmd.exe /c "MyService.exe install start"" Return="check" />
<CustomAction Id="UninstallService" Directory="INSTALLFOLDER" Execute="deferred" Impersonate="no" ExeCommand="cmd.exe /c "MyService.exe uninstall"" Return="ignore" />
<CustomAction Id="UpgradeService" Directory="INSTALLFOLDER" Execute="deferred" Impersonate="no" ExeCommand="cmd.exe /c "MyService.exe uninstall"" Return="check" />
InstallService and UninstallService work as intended. UpgradeService is the one that should be called before installing the new files, no matter if it is a minor update or a major upgrade.
The problem is, when version 1.0.0.0 is already installed, and I install the MSI with version 1.0.1.0, Topshelf tells me that "This service has already been installed", though Windows validates the installation (Control Panel's list of installed apps shows the new version).
So two questions:
- Seems like the new MSI does not call the "UpgradeService" custom action, but I have no way to prove it. Is there a way to track whether the custom actions are acknowledged by the installer?
- I'm also aware on what to do when doing a Major Upgrade (change the UpgradeCode), as per the WiX documentation details. However, this is a minor update. Am I missing any further settings?
Thanks in advance!
EDIT:
I got suggested to use ServiceInstall and ServiceControl, but I run into the same issue... Here's how it looks on my WXS file:
<ServiceInstall Id='MyService.exe' Name="MyService" Type='ownProcess' Start='auto' Vital='yes' ErrorControl='normal' />
<ServiceControl Id='MyService.exe' Start='install' Stop='both' Remove='uninstall' Wait='yes' />
Problem with "This service has already been installed" persists :(