6

During uninstall progress, the installer displays below message:

"The setup must update files or services that cannot be updated while the system is running. If you choose to continue, a reboot will be required to complete the setup."

I think it's caused by the installed service is still running while uninstalling. So, I try to write a custom action to stop it. But, it seems not work.

If I set the action as Execute='deferred' Impersonate='no', it only allows me to put action between InstallInitialize and InstallFinalize, so I have to set it as "immediate".

<CustomAction BinaryKey='CustomActions' Id='StopService' DllEntry='StopService' Execute='immediate' />

<Custom Action="StopService" Before="InstallValidate">REMOVE="ALL"</Custom>

Also note that, I have to use custom action to install service manually instead of using Wix by some reasons. That's why I'm trying to remove it manually.

Cœur
  • 37,241
  • 25
  • 195
  • 267
jcha
  • 629
  • 1
  • 8
  • 16
  • You should call custom action after Install Finalize. Then after your custom action you can call WIX action to install service. – Sunil Agarwal Sep 10 '11 at 10:40
  • Thanks for suggestion but the service was installed just well by custom action. My concern is how to suppress the message above during uninstall process. – jcha Sep 12 '11 at 02:49
  • @jcha, may be it's possible to run a special executable that stop's the service from bootstraper before uninstalling the product. I also have the same problem.. – Nerielle Nov 01 '11 at 06:02
  • For a similar case, I used a custom action to uninstall the service by running the custom action Before="RemoveFiles". I am sure whether this works for all scenarios. – hetptis Nov 11 '19 at 05:24

1 Answers1

4

You cannot run an elevated custom action before InstallInitialize. If you were to install the service normally, MSI would take care of stopping the service for you and not show the in-use message.

Bob Arnson
  • 21,377
  • 2
  • 40
  • 47
  • Thanks for your info but I'm still not clear. Because if I put the custom action after `InstallInitialize`, it would throw the message "The setup must update files or services that cannot be updated..." during uninstall `InstallValidate` step. – jcha Sep 12 '11 at 02:34
  • There's no way to run an elevated custom action to prevent a files-in-use message. If you use the built-in service functionality, MSI won't show an in-use message because it knows it will be stopping and removing the service. – Bob Arnson Sep 12 '11 at 02:43
  • @BobArnson , that is not quite right... I am running into just this problem with wix 3.10.3. Wix is managing a service, but still throws that message during the validate step, when upgrading. – Jon Sep 21 '16 at 18:25
  • If there are other programs that use files with the same name on different location then then also a file in use dialog showing. In my case it are files from the C runtime which is used from a large range of files. – Horcrux7 May 08 '19 at 10:58