[英]Wix Installer error during upgrade-The setup must update files or services that cannot be updated while system is running
我在卸載產品或卸載階段的主要更新期間(當產品服務正在運行時)收到警告消息:
“安裝程序必須更新在系統運行時無法更新的文件或服務。如果您選擇繼續,則需要重新啟動才能完成安裝程序。”
故事從這里開始
我開發了 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 安裝程序升級具有相同的“升級代碼”ID 顯示權限錯誤提示
問題解決了。 罪魁禍首低於代碼
<util:ServiceConfig xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
FirstFailureActionType="restart"
SecondFailureActionType="restart"
ThirdFailureActionType="restart" />
我添加了以下延遲,現在一切都像魅力一樣工作。
RestartServiceDelayInSeconds="60"
感謝有人認為需要RestartServiceDelayInSeconds
。 ServiceConfig
實用程序開發期間的ServiceConfig
思考
所以我正在安裝 MongoDB 並且此消息不斷彈出。 我試着點擊 OK 認為它會重新啟動系統,但什么也沒發生。 然后我關閉了互聯網並重試。 有效。 這很奇怪,但這就是我的問題得到解決的方式。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.