We have a windows service installed as a part of our msi WIX installer . During upgrade we are trying to just restart service instead of doing complete reinstall to safe guard the service user creds.
A lot of posts discussed in this regard but nothing is conclusive.
Tried out disabling DeleteServices during upgrade by doing below,
<InstallExecuteSequence>
<DeleteServices>NOT UPGRADINGPRODUCTCODE</DeleteServices>
</InstallExecuteSequence>
Note: The above code is in old MSI as well
But still saw service getting actually deleted and reinstalled. Tried disabling installservice during upgrade as below
<InstallServices>NOT WIX_UPGRADE_DETECTED</InstallServices>
But service is in stopped state and installer fails in action, ExecServiceConfig with code 1603 since service is not in running state.
Any pointers on this will be helpful
I wrote an answer for something similar (I think) a while back: Wix: Windows Service sometimes uninstalled when upgrading. Please read that link for several, different suggestions.
Minor Upgrade: In addition to the options in the linked answer, you can use a minor upgrade as well - if that is at all a viable option. In a minor upgrade the product is not uninstalled and then reinstalled, but rather upgraded "in-place". For minor upgrades to work you need to follow the component rules to the letter - which can be hard to do, but you can then definitely upgrade without losing your service creds. See bottom here for how a minor upgrade is applied. And I will just link to an answer with a little bit of info on late REP.
Permanent Component: As the linked answer above states, you can set the component with the service configuration settings to be permanent. In this case it will never be uninstalled during upgrade, but not during a real uninstall either. Accordingly you have to manually clean out the service installation and file installation on "real" uninstall (as opposed to a major upgrade initiated uninstall which sets UPGRADINGPRODUCTCODE
). Sort of an easy approach that I don't really like that much.
(Managed) Service Accounts: Not something I have used, but the newer concept of managed service accounts as described in the above, linked answer could be investigated? Step-by-step.
Late REP / Service MSI: Scheduling RemoveExistingProducts
correctly late means your service should not be uninstalled during upgrade scenarios (see the linked answer for details). It can be hard to follow all component rules to the letter, but you can ease that by putting your service in its own, minimal service installation MSI, and then installing via a WiX Burn bundle (installing MSI files in sequence).
As stated several times, please do read this similar answer: Wix: Windows Service sometimes uninstalled when upgrading.