我在Visual Studio中使用安装项目(.msi)。
安装步骤:
更新步骤:
我的构建服务器仅使用msbuild构建,无法构建安装项目(.msi)。
我必须在构建服务器上安装Visual Studio,还是有更好的选择?
答案 0 :(得分:4)
使用installutil.exe更容易,更快......您可以使用installutil /u myservice.exe
在服务器上停止和卸载服务,删除旧文件,复制新文件并使用installutil myservice.exe
重新启动 - 安装你的服务......
答案 1 :(得分:1)
为此,我使用Phil Wilsons ReadSvcXml.exe工具,当在安装项目上作为后期构建事件运行时,更新安装程序msi文件,其中包含特定信息,可以重定向服务(即包括添加依赖项,以在卸载时停止服务,注册它等)。这是在安装完成后自动启动服务的最简单,最可靠的方法。
例如,安装项目的后期构建事件是: .. \ ReadSvcXml.exe MyApplication.msi .. \ ServiceSetup.xml
ServiceSetup.xml的位置如下:
<ServiceData>
<FileName>MyServiceHost.exe</FileName>
<ServiceInstall>
<Id>ServiceInstallColumn</Id>
<Name>GatewayServer</Name>
<DisplayName>Company MyServer</DisplayName>
<ServiceType>ownprocess </ServiceType> <!-- or shareprocess-->
<Interactive>no</Interactive>
<Start>auto</Start> <!--auto demand or disabled-->
<ErrorControl>
<!--ignore normal critical -->
normal
</ErrorControl>
<Dependencies>MSSQLSERVER</Dependencies>
<Description>MyServer for blar blar blar</Description>
</ServiceInstall>
<ServiceControl>
<Name>MyServerName</Name>
<Id>MyServerId</Id>
<!-- install, uninstall or both-->
<Start>install</Start>
<Stop>both</Stop>
<Remove>uninstall</Remove>
<Wait>no</Wait> <!-- no yes -->
</ServiceControl>
</ServiceData>
可以在这里下载SvcInstall:
download svcinstall bin and source