0
votes

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
When did you schedule RemoveExistingProducts? It may work if you schedule it afterInstallExecute since the 1.1 installer will no longer try to uninstall the service due to component reference counting if your 1.1 install followed the suggested component rules. - Brian Sutherland
@BrianSutherland I've not defined it, I'm relying MajorUpgrade I suppose. Are you suggesting to add <RemoveExistingProducts After="InstallExecute"/> in the <InstallExecuteSequence>? - peval27
@BrianSutherland or better, use Schedule="afterInstallExecute" in the MajorUpgrade - peval27
Yes, I'm suggesting exactly that. However, this can result in several issues if file versioning is not properly done since it will not update the files. This should work nicely if a bunch of "best practices" were followed but this is not guaranteed to be the case. - Brian Sutherland
If this doesn't work you may have to author a patch to the 1.1 msi using your 1.1tweaked (stackoverflow.com/questions/28462231/…). Or just put a message into your 1.2 installer telling the user to stop the service since you cannot make a deferred custom action to stop the service that runs before RemoveExistingProducts if you schedule RemoveExistingProducts any earlier. - Brian Sutherland

1 Answers

0
votes

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.