开发者

Stop a service before installation

I wrote an application that installs using the Visual Studio 2010 Setup Project. As part of its installation, my application installs and starts a Windows S开发者_运维百科ervice. No problems there.

When I release a new version of the application, the installer overwrites the contents of the application folder. Unfortunately, it cannot overwrite the service as it is already running.

How can I stop the service before the MSI starts copying files? I'm considering a custom bootstrapper (installer prerequisit) that doesn't install, but removes the service. Or can I use Orca to add an action before installation? Or do you know another way?


Usually this is done through service control operations. Basically, you need the Stop and Delete flags set for uninstall.

Another approach would be to use ServiceInstaller.Uninstall in a custom action to stop and remove the service.

If you want to avoid the files in use dialog, you can try this approach: Problem stopping Windows Service from Installer Class. Events fire too late

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜