首页 > 解决方案 > 升级期间出现 Wix 安装程序错误 - 安装程序必须更新系统运行时无法更新的文件或服务

问题描述

我在卸载产品或卸载阶段的主要更新期间收到警告消息(当产品服务正在运行时):

“安装程序必须更新系统运行时无法更新的文件或服务。如果选择继续,则需要重新启动才能完成安装程序。”

故事从这里开始

我已经开发了 windowsservice并使用创建了installer[msi] Wix,然后分发给了用户。它按预期工作。

现在,是时候交付具有服务增强功能的新版本了。因此,我创建了一个新的msi. 我希望新的执行msi应该upgrade是现有的应用程序。

但我得到以下错误

安装程序必须更新系统运行时无法更新的文件或服务

为了支持 MSI 升级,我做了以下更改

产品部分的现有代码

  <?define UpgradeCode = "{3D197FE4-86DF-31FD-A0CD-21B5D3B97ABC}" ?>
  <Product Id="$(var.ProductCode)" 
       Name="!(loc.ProductName_$(var.Platform)) $(var.ProductVersion)"
       Language="!(loc.Language)" 
       Version="$(var.BuildVersion)"
       Manufacturer="!(loc.Company)" 
       UpgradeCode="$(var.UpgradeCode)">

代码改了,这里Product ID改成*

  <?define UpgradeCode = "{3D197FE4-86DF-31FD-A0CD-21B5D3B97ABC}" ?>
  <Product Id="*" 
       Name="!(loc.ProductName_$(var.Platform)) $(var.ProductVersion)"
       Language="!(loc.Language)" 
       Version="$(var.ProductVersion)"
       Manufacturer="!(loc.Company)" 
       UpgradeCode="$(var.UpgradeCode)">

注意upgrade code从旧版本到新版本没有变化。

用于升级的现有代码

    <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeErrorMessage)" />

更新了升级代码

      <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeErrorMessage)"
                AllowDowngrades="no"
                AllowSameVersionUpgrades="yes" 
                RemoveFeatures="ALL" 
                Schedule="afterInstallInitialize"/>

跟服务有关系吗?

     <ServiceControl Id="myservice"
                    Name="GatewayService"
                    Start="install"
                    Stop="both"
                    Remove="uninstall" Wait="yes" />

安装顺序

在此处输入图像描述

如何摆脱这个提示?如果服务停止,为什么它会来。

在此处输入图像描述

部分日志

     MSI (s) (78:5C) [19:54:21:691]: WIN64DUALFOLDERS: Substitution in 'C:\Program Files (x86)\Service\Service.dll' folder had been blocked by the 1 mask argument (the folder pair's iSwapAttrib member = 0).
     The setup must update files or services that cannot be updated while 
     the system is running. If you choose to continue, a reboot will be 
     required to complete the setup.
     MSI (s) (78:5C) [19:54:53:705]: Note: 1: 2727 2:  
     MSI (s) (78:5C) [19:54:53:706]: Doing action: RemoveExistingProducts
     MSI (s) (78:5C) [19:54:53:706]: Note: 1: 2205 2:  3: ActionText 
     Action ended 19:54:53: InstallValidate. Return value 1.
     MSI (s) (78:5C) [19:54:53:706]: Skipping RemoveExistingProducts action: 
     current configuration is maintenance mode or an uninstall
     Action start 19:54:53: RemoveExistingProducts.
     MSI (s) (78:5C) [19:54:53:706]: Doing action: InstallInitialize
     MSI (s) (78:5C) [19:54:53:706]: Note: 1: 2205 2:  3: ActionText 
     Action ended 19:54:53: RemoveExistingProducts. Return value 0.
     MSI (s) (78:5C) [19:54:53:708]: Machine policy value 'AlwaysInstallElevated' is 0
     MSI (s) (78:5C) [19:54:53:708]: User policy value 'AlwaysInstallElevated' is 0

我有以下代码可以在失败时重新启动服务。你认为这会导致问题吗?

       <util:ServiceConfig xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
                FirstFailureActionType="restart"
                SecondFailureActionType="restart"
                ThirdFailureActionType="restart" />

问题根源

我看到旧版本在升级过程中没有被删除。因此在这里创建了一个新问题Wix installer upgrade with same "upgrade code" ID shows privilege error prompt

标签: wixinstallationupgrade

解决方案


所以我正在安装 MongoDB 并且此消息不断弹出。我尝试单击“确定”,以为它会重新启动系统,但什么也没发生。然后我关闭了互联网并重试。有效。这很奇怪,但这就是我的问题得到解决的方式。


推荐阅读