I'm working on an installer that is supposed to install several Windows services. We make new builds (with new .msi files) pretty often, and we use major upgrades to make it easy to install over a previous installation.
The problem is that we need to update the service files without overwriting the service configuration (account username and password, for instance).
We're using ServiceInstall and ServiceControl inside the component that holds the service exe file. Is there a way to make the execution of ServiceInstall conditional (using a condition like REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE) so the service is not uninstalled when upgrading (just stopped so we can upgrade the files)?
One solution would be to use custom actions, but maybe there is a better way?
Thanks!
It seems I was looking in the wrong place. The solution to my problem is to add the NOT UPGRADINGPRODUCTCODE to the DeleteServices standard action.
This fixes my problem. The caveat of this approach is that all services installed by the current msi file are deleted (or not). So I can't delete/keep services selectively on an upgrade. This is fine with me, however - my requirement of keeping the service logon information (but not the actual service code) across upgrades is fulfilled.
UPDATE: The condition for DeleteServices is accessible from WiX in the InstallExecuteSequence element.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With