Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to only stop and not uninstall windows services when major upgrade in wix?

I'm working on an installer that is supposed to install Windows services in wix v3.8. The problem is that we need to make a major upgrade without uninstalling the service only to stop it.

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 474
zhoulin Wang Avatar asked Dec 26 '22 05:12

zhoulin Wang


1 Answers

You would have to override the action that process those elements. The following may work as long as you are okay if it applies to all services in your MSI package (if you only have one service then good on ya):

<InstallExecuteSequence>
   <DeleteServices>NOT UPGRADINGPRODUCTCODE</DeleteServices>
</InstallExecuteSequence>

You don't need to condition for remove since the DeleteServices would already factor in the state of the Component.

like image 90
Rob Mensching Avatar answered Jan 03 '23 01:01

Rob Mensching