views:

21

answers:

1

I have a WiX installer that runs a program that downloads the latest version of my code and installs three windows services. I have a custom action runs another program that shuts down and uninstalls the services during uninstallation, after InstallInitialize. The uninstaller also deletes all files and directories that get downloaded. However, when I RmeoveFile actions to delete the files, it prompts the user to shut down the services, since it must detect the conflict. I would like to avoid this, since my custom action does that anyway.

So I need a way to do either of the following:

  1. Run the custom action (and thus my program that shuts down the services) before the installer does whatever check it does that tells it that the services need to be shut down.

  2. Tell the installer to automatically shut down the services without prompting the user to do so. Unfortunately, the install package doesn't include the services, they get downloaded by my app, so I"m not sure how I"d do this.

Can either of these things be done?

+1  A: 

The easy fix is to get rid of the custom action. Windows Installer can be told to manage services that it didn't create. Just author ServiceControl elements like this:

<Component...
  <ServiceControl Id="sc1" Name="fooservice" Remove="uninstall" Stop="uninstall"/>
</Component>
Christopher Painter
Will that not prompt the user to shut the service down?
Mike Pateras
It won't prompt, it'll just do it.
Christopher Painter