升级Windows服务,而不卸载 [英] Upgrade a Windows Service without Uninstalling

查看:276
本文介绍了升级Windows服务,而不卸载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我之前,我安装新版本卸载旧版本,我的服务。我是pretty的肯定,这有什么关系呢不是足够聪明来更新或添加新的之前删除旧的服务项目。

Currently I have to uninstall the old version of my service before I install the new version. I am pretty sure this has something to do with it not being smart enough to update or remove the old service entries before adding the new ones.

有没有办法让安装程序跳过,如果它已经存在注册的服务? (我可以假设安装文件夹和服务名称不版本之间切换。)

Is there a way to have the installer skip registering the service if it already exists? (I can assume the installation folder and service name do not change between versions.)

另外,有没有办法卸载时自动停止服务?

Also, is there a way to automatically stop the service when uninstalling?


我使用MSI包和Visual Studio的安装项目。

I am using MSI packages and the Visual Studio setup project.

推荐答案

我曾与WiX的,产生使用,则ServiceInstall和放大器的.msi文件做到了这一点; SeviceControl命令:

I've done this with WiX, which generates .MSI files using the ServiceInstall & SeviceControl commands:

<Component Id='c_WSService' Guid='*'>
    <File Id='f_WSService' Name='WSService.exe' Vital='yes' Source='..\wssvr\release\wsservice.exe' />
    <ServiceInstall Id='WSService.exe' Name='WSService' DisplayName='[product name]' Type='ownProcess'
                    Interactive='no' Start='auto' Vital='yes' ErrorControl='normal'
                    Description='Provides local and remote access to [product name] search facilities.' />
    <ServiceControl Id='WSService.exe' Name='WSService' Start='install' Stop='both' Remove='uninstall' Wait='yes' />
</Component>

这将停止服务,安装新版本并重新启动该服务。

This stops the service, installs the new version and re-starts the service.

这篇关于升级Windows服务,而不卸载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆