Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wix Major Upgrade: how do I prevent Windows service reinstallation?

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!

like image 469
Miron Brezuleanu Avatar asked Feb 09 '10 12:02

Miron Brezuleanu


1 Answers

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.

like image 100
Miron Brezuleanu Avatar answered Sep 28 '22 06:09

Miron Brezuleanu