【问题标题】:Can Wix skip InstallValidate during installation on Windows在 Windows 上安装期间,Wix 可以跳过 InstallValidate
【发布时间】:2018-03-12 17:30:18
【问题描述】:

我正在使用 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 分钟)才能通过该阶段,然后重新安装一切正常。有什么方法可以让它更快甚至跳过它?

应用服务相关的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?

【问题讨论】:

  • 明确地说,这些实际的 Windows 服务是否使用 ServiceControl 元素安装并使用 ServiceControl 停止?我还要补充一点,检查正在使用的文件并不是 InstallValidate 所做的唯一事情。
  • 好电话,我已经更新了问题,谢谢

标签: windows wix windows-installer installation


【解决方案1】:

如果我错了,请纠正我。

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

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

【讨论】:

  • 我刚刚遇到了这个确切的问题。在 InstallValidate 之前如何调用您的流程?
  • 使用自定义操作并在 InstallValidate 之前指定它。但是如果你还想设置一个条件,它就有一个缺点,例如升级。从 MS doc 中,直到 InstallValidate 之后才会设置某些值。因此,一种解决方案是始终运行您的流程并忽略返回值,让您的流程处理不同的情况。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-05-23
  • 2011-12-10
  • 1970-01-01
相关资源
最近更新 更多