【发布时间】:2019-08-28 04:40:31
【问题描述】:
我在卸载产品或卸载阶段的主要更新(当产品服务正在运行时)时收到警告消息:
“安装程序必须更新系统运行时无法更新的文件或服务。如果选择继续,则需要重新启动才能完成安装程序。”
故事从这里开始
我开发了 Windows service 并使用 Wix 创建了 installer [msi],然后分发给用户。它按预期工作。
现在,是时候交付具有服务增强功能的新版本了。因此,我创建了一个新的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
【问题讨论】:
-
你有a full, verbose log吗?安装时使用了哪些文件?如果您在尝试覆盖之前不停止服务,服务经常会导致此错误,但看起来您正确地停止了它们。 从服务控制小程序手动停止服务需要多长时间?您安装的其他二进制文件或任何其他文件是否可能被锁定?
-
当我手动尝试时,服务需要 4-5 秒才能停止。我已经上传了有问题的安装顺序的屏幕截图。没有其他文件被锁定。只有一个与服务锁定相关的 EXE。
-
您是否在安装时设置
REINSTALLMODE="amus"?您是否包括任何合并模块或运行时?也许快速检查一下:advancedinstaller.com/forums/viewtopic.php?t=35059 - 你降级文件吗? -
不,我没有设置 REINSTALLMODE="amus"。我不包括任何合并模块。
-
我在控制面板中看到已经有旧版本的“服务”在升级过程中没有被卸载。我认为这导致服务不删除。我们如何确保在升级时删除旧的?我已经卸载了旧版本,然后在没有任何提示的情况下卸载了新版本。
标签: wix installation upgrade