Win service not stopped and uninstalled during upgrade

160 Views Asked by At

I am having an issue with an installer built with Wix 3.7. I have a product which install a Windows Service. The problem is that during a product upgrade (from version 1.1 to version 1.2, same UpgradeCode, different ProductCode Guid and MajorUpgrade property used) I want to replace the executable ran by the Service. The file is in use by the old process (i.e. the Windows service). I suspect that the 1.1 installer is used to uninstall the 1.1 product, and in that installer the ServiceControl was invalid (i.e. not set to stop on uninstall).

My guess:

  1. 1.2 installer detects existing product (due to upgrade code)
  2. uninstall the old product
  3. the service is not stopped/uninstalled due to a bug in 1.1 installer
  4. 1.2 tries to replace the executable, but a process is still running the executable.

Note that I have tweaked the 1.1 installer using Orca to have a correct ServiceControl which stops and remove the service on uninstall. We call this 1.1tweaked. If I install the product using 1.1tweaked and then use my 1.2 installer than everything works as expected.

I have already tried any possible configuration of the ServiceControl in 1.2 installer, but it's useless if the steps above are right.

How can I force to stop the "current" Windows Service in the 1.2 installer? It looks like I need a Custom Action. Any ideas? Thanks

1

There are 1 best solutions below

0
On BEST ANSWER

Following the comments, these are the possible solutions:

  • create a patch for the 1.1 installer following this SO question
  • use the attribute Schedule="afterInstallExecute" in the MajorUpgrade. This may work if the components are well defined and file are versioned correctly.
  • inform the user to stop the service.