6
votes

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.

1
You should call custom action after Install Finalize. Then after your custom action you can call WIX action to install service. - Sunil Agarwal
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
@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
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. - Prasad

1 Answers

4
votes

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.