简体   繁体   English

升级期间 Wix 安装程序错误 - 安装程序必须更新系统运行时无法更新的文件或服务

[英]Wix Installer error during upgrade-The setup must update files or services that cannot be updated while system is running

I come upon the warning message during uninstalls a product or major updates in the uninstall phase (when a product service is running):我在卸载产品或卸载阶段的主要更新期间(当产品服务正在运行时)收到警告消息:

"The setup must update files or service that cannot be updated while the system is running. If you choose continue, a reboot will be required to complete the setup." “安装程序必须更新在系统运行时无法更新的文件或服务。如果您选择继续,则需要重新启动才能完成安装程序。”

Story starts here故事从这里开始

I have developed the windows service and created the installer [msi] using Wix , then distributed to users.我开发了 Windows service并使用Wix创建了installer [msi],然后分发给用户。 it is working as expected.它按预期工作。

Now, it's time to deliver a new build with service enhancements.现在,是时候交付具有服务增强功能的新版本了。 Hence, I have created a new msi .因此,我创建了一个新的msi I was hoping that the execution of new msi shall upgrade the existing application.我希望新msi的执行会upgrade现有的应用程序。

But I get below error但我得到以下错误

The setup must update files or services that cannot be updated while the system is running安装程序必须更新系统运行时无法更新的文件或服务

To support MSI upgrade, I have made below changes为了支持 MSI 升级,我进行了以下更改

Existing code for Product section产品部分的现有代码

  <?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)">

Changed code , Here Product ID changed to *更改代码,此处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)">

Observe that upgrade code is not changed from old version to new version.观察upgrade code没有从旧版本更改为新版本。

Existing code for upgrade现有的升级代码

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

Updated code for upgrade更新的升级代码

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

Is it anything to do with service?跟服务有关系吗?

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

Install Sequence安装顺序

在此处输入图片说明

How to get rid of this prompt?如何摆脱这个提示? Also why it's coming if service is stopped.如果服务停止,为什么会出现这种情况。

在此处输入图片说明

Some part of logs部分日志

     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

I have below code to restart service on failure.我有以下代码可以在失败时重新启动服务。 do u think it causes issue?你认为它会导致问题吗?

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

Issue root cause问题根本原因

I see that old version is not getting deleted during upgrade.我看到旧版本在升级过程中没有被删除。 Hence created a new question here Wix installer upgrade with same "upgrade code" ID shows privilege error prompt因此在这里创建了一个新问题Wix 安装程序升级具有相同的“升级代码”ID 显示权限错误提示

Issue resolved. 问题解决了。 Culprit was below code 罪魁祸首低于代码

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

I have added delay as follow, and everything working like charm now. 我添加了以下延迟,现在一切都像魅力一样工作。

     RestartServiceDelayInSeconds="60"

Thanks to someone who thought the need for RestartServiceDelayInSeconds . 感谢有人认为需要RestartServiceDelayInSeconds Great thinking during ServiceConfig utility development ServiceConfig实用程序开发期间的ServiceConfig思考

So I was installing MongoDB and this message kept popping up.所以我正在安装 MongoDB 并且此消息不断弹出。 I tried clicking on OK thinking that it would reboot the system but nothing happened.我试着点击 OK 认为它会重新启动系统,但什么也没发生。 Then I turned off my internet and retried.然后我关闭了互联网并重试。 It worked.有效。 This was weird but that's how my problem got resolved.这很奇怪,但这就是我的问题得到解决的方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM