WIX(删除所有以前的版本)

WIX (remove all previous versions)

在"Add or remove programs"下我可以看到五个版本:

- ApplicationName v3.0.4.0
- ApplicationName v3.0.4.18
- ApplicationName v3.0.5.27
- ApplicationName v3.0.5.28
- ApplicationName v3.0.5.29

尝试安装 ApplicationName v3.0.5.30 时,不会删除所有以前的版本。 保留的版本是:

- ApplicationName v3.0.4.0
- ApplicationName v3.0.4.18

我已经阅读了 How to implement WiX installer upgrade?

上的所有内容

我使用的代码是:

<Product Id="*"
   UpgradeCode="$(var.UpgradeCode)"
   Version="$(var.Version)"
   Language="1033"
   Name="$(var.ProductDisplayName) (v$(var.Version))"
   Manufacturer="Unknown">
<Package InstallerVersion="380" Compressed="yes"/>
<Media Id="1" Cabinet="IileServer.cab" EmbedCab="yes" />

<Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
<Upgrade Id="$(var.UpgradeCode)">
  <UpgradeVersion
  Minimum="0.0.0.0" Maximum="99.0.0.0"
  Property="PREVIOUSVERSIONSINSTALLED"
  IncludeMinimum="yes" IncludeMaximum="no" />
</Upgrade>

<InstallExecuteSequence>
  <RemoveExistingProducts Before="InstallInitialize" />
</InstallExecuteSequence> 

我做错了什么?

我也尝试构建版本 v3.0.6.0,安装后我得到了相同的结果。

Versions v3.0.5.X was removed
Versions v3.0.4.X was not uninstalled

所有版本的UpgradeCode都一样,我用Orca看过 image

图像上的最后升级代码适用于版本 3.0.6.0

忽略数字:摘自 ProductVersion property:

的 MSI SDK 文档

"Note that Windows Installer uses only the first three fields of the product version. If you include a fourth field in your product version, the installer ignores the fourth field...At least one of the three fields of ProductVersion must change for an upgrade using the Upgrade table."


为了摆脱野外安装,有几种方法。

按产品代码卸载:如果您要交付一个产品代码,我会得到一个产品代码列表并在公司范围内卸载-家庭申请: The list of product codes you assemble can then be passed to msiexec.exe /x {productcode} as explained in section 3 here。只是一个简单的批处理文件。或者您可以尝试 WMI,或其他方法之一。

通过升级代码卸载:您可以使用此处的代码检查所有安装版本是否共享相同的升级代码: (they probably do). There is even a VBScript version here. Throwing in a link to an answer where I link to several other ways to uninstall, such as by uninstalling all setups that share the same upgrade code. And a direct link to actual code to do so (uninstall by upgrade code).

按产品名称卸载:您也可以按产品名称匹配卸载。这里有一些示例 (VBScript):. And here is a .NET DTF uninstall function: Uninstalling program(非常简单,需要针对实际使用进行调整)。


一些链接: