gpt4 book ai didi

installation - MSI 安装失败,因为 "Another version of this product is already installed"

转载 作者:行者123 更新时间:2023-12-03 23:53:51 24 4
gpt4 key购买 nike

我们使用 MSIEXEC 和以下命令行选项安装应用程序 (MSI):

MsiExec.exe /x{code} /qn /liwearucmopvx+ C:\Log\UnInstall.tra
MsiExec.exe /iC:\Source\App.msi /qn TARGETDIR=C:\Install ALLUSERS=1 /liwearucmopvx+ %C:\Log\Install.tra

大多数情况下这是有效的,但有时卸载失败(不知道为什么,查看错误)。无论如何,当发生这种情况时,我在重新安装期间收到以下错误:
Another version of this product is already installed.  Installation of this version cannot continue.  To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel

有没有办法绕过这个?意思是确保我们总是重新安装(如果它存在,我们可以简单地自动将它吹走?)

最佳答案

查看 MSDN Documentation on the Upgrade Table ,基本上你需要设置 msidbUpgradeAttributesVersionMaxInclusive 位。

如果您使用 WiX 3.5,请不要说明您使用什么来构建安装程序。或以后您可以使用 MajorUpgrade/@AllowSameVersionUpgrades="yes"为您解决这个问题。

Note that because MSI ignores the fourth product version field, setting this attribute to yes also allows downgrades when the first three product version fields are identical. For example, product version 1.0.0.1 will "upgrade" 1.0.0.2998 because they're seen as the same version (1.0.0). That could reintroduce serious bugs so the safest choice is to change the first three version fields and omit this attribute to get the default of no.



请注意,不必记住包代码(如果您在持续集成中使用自动生成的包代码,这真的很痛苦),以下 VBScript 将通过搜索已安装产品的列表并查找包代码本身来按名称删除包.

Option Explicit
Dim productName, productCode, installer
productName = "My Application"

Set installer = Wscript.CreateObject("WindowsInstaller.Installer")

For Each productCode In installer.Products
If InStr(1, LCase(installer.ProductInfo(productCode, "ProductName")), LCase(productName)) Then Exit For
Next

If Not IsEmpty(productCode) Then
Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec("msiexec /x " & productCode & " /qb /l*v ""%temp%\UninstallApp.log"" ")
End If

关于installation - MSI 安装失败,因为 "Another version of this product is already installed",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3970862/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com