使用wix安装可能已经安装的Windows服务

时间:2019-09-06 14:58:50

标签: wix windows-services windows-installer

我正在使用WiX 3.1.1安装exe和服务。有时,MSI安装会失败,并显示一个相当普遍的错误:

Error 1923. Service 'MyService' (MyService) could not be installed.
Verify that you have sufficient privileges to install system services.

实验上,这似乎是因为该服务已经存在,并且我的xml使用Vital="yes"

我希望MSI确保已安装该服务,但是如果已经存在,则接受(或修复)该服务。听起来我应该设置Vital="no",这会导致它忽略 other 错误吗?有没有一种方法可以限制忽略哪些错误?我缺少最佳实践吗?

作为参考,我的xml的摘要片段:

<Component Id="REDACTED" Guid="{REDACTED}" Win64="yes">
  <File
      Id="filB754EE270009E240193A8279D1529A43"
      Name="myservice.exe"
      KeyPath="yes"
      DiskId="1"
      Source="SourceDir\File\filB754EE270009E240193A8279D1529A43" />
  <ServiceControl
      Id="MyService"
      Name="MyService"
      Start="install"
      Stop="both"
      Remove="uninstall"
      Wait="no" />
  <ServiceInstall
      Id="MyService"
      Name="MyService"
      Type="ownProcess"
      Start="auto"
      ErrorControl="normal"
      Vital="yes"
      Account="[SERVICEACCOUNT]"
      Arguments="svc -config &quot;C:\Program Files\MyService\conf\service.flags&quot;"
      Description="My Service">
    <ServiceConfig
        ServiceName="MyService"
        FirstFailureActionType="restart"
        SecondFailureActionType="restart"
        ThirdFailureActionType="restart"
        ResetPeriodInDays="1"
        RestartServiceDelayInSeconds="5"
        xmlns="http://schemas.microsoft.com/wix/UtilExtension" />
  </ServiceInstall>
</Component>

0 个答案:

没有答案
相关问题