在Windows上安装期间,Wix可以跳过InstallValidate

时间:2018-03-12 17:30:18

标签: windows wix windows-installer installer

我正在使用Wix将app-service-controller,app-service,app-core和app-tray打包到安装程序中。在升级过程中,安装程序会执行Installvalidate步骤,该步骤会对我所有进程中使用的文件进行投诉。

安装输出如下

Info 1603.The file C:\Program Files\app\app-service-controller.exe is being held in use by the following process: Name: app-service-controller, Id: 26308, Window Title: '(not determined yet)'.  Close that application and retry.
Info 1603.The file C:\Program Files\app\app-service.exe is being held in use by the following process: Name: app-service, Id: 26028, Window Title: '(not determined yet)'.  Close that application and retry.
Info 1603.The file C:\Program Files\app\app-core.exe is being held in use by the following process: Name: app-core, Id: 25932, Window Title: '(not determined yet)'.  Close that application and retry.
Info 1603.The file C:\Program Files\app\app-tray.exe is being held in use by the following process: Name: app-tray, Id: 25856, Window Title: '(not determined yet)'.  Close that application and retry.
MSI (s) (A0:30) [12:43:46:999]: 4 application(s) had been reported to have files in use.
MSI (c) (04:48) [12:43:47:000]: File In Use: -app-service-controller- Window could not be found. Process ID: 26308
MSI (c) (04:48) [12:43:47:000]: File In Use: -app-service- Window could not be found. Process ID: 26028
MSI (c) (04:48) [12:43:47:000]: File In Use: -app-core- Window could not be found. Process ID: 25932
MSI (c) (04:48) [12:43:47:001]: File In Use: -app-tray- Window could not be found. Process ID: 25856
MSI (c) (04:48) [12:43:47:001]: No window with title could be found for FilesInUse

问题是需要很长时间,大约5到10分钟才能通过那个阶段,然后重新安装一切都很好。有没有办法让它更快或甚至跳过它?

与app-service相关的Wix代码

<ServiceInstall
    Id="ServiceInstall" Name="App-Service-Controller" DisplayName="$(var.Name)"
    Description="Controls the $(var.Name) foreground processes."
    Type="ownProcess" Start="auto" ErrorControl="normal">
    <util:ServiceConfig
        FirstFailureActionType='restart'
        SecondFailureActionType='restart'
        ThirdFailureActionType='restart'
        RestartServiceDelayInSeconds='1'
        ResetPeriodInDays='1'/>
    </ServiceInstall>
<ServiceControl
    Id="ServiceControl" Name="App-Service-Controller"
    Start="install" Stop="both" Remove="uninstall" Wait="yes"/>

相关帖子:

MSI: How a Service is stopped on uninstall during InstallValidate - could that work anyway?

How does the MSI Installer InstallValidate determine files in use?

1 个答案:

答案 0 :(得分:1)

如果我错了,请纠正我。

  • 无法绕过InstallValidate。 Wix会给你一个错误 说它是必需的。
  • 您无法在InstallValidate之前重新排序StopService步骤。
  • 您无法在InstallValidate之前以管理员身份运行自定义操作。

所以我最终创建了一个可以在InstallValidate之前执行的新进程。在这个过程中,我使用RPC告诉我的服务停止。