views:

289

answers:

3

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!

A: 

I've run into this same problem, and haven't found a solution yet.

Steve
A: 

WiX will only update components if their version is newer. It only checks one of the fields (File version of assembly version, I can't remember) so you can keep current version info in one and keep it static in the other. This might be a hack that works for you...

Tom the Junglist
Well, the problem is that I need to replace the files, but not the configuration. If I had control over how the configuration is stored, I would use NeverOverwrite and Permanent on those files. But here the problem is that the password is LSA stored - hence the need to make ServiceInstall conditional.
Miron Brezuleanu
+2  A: 

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.

Miron Brezuleanu

related questions