如何让 WIX MSI 始终删除以前的版本? [英] How do I make a WIX MSI always remove a previous version?
问题描述
每当开发人员签入更改时,我都会让 CI 构建系统构建一个 MSI.我们对已安装的 MSI 运行自动化验收测试.
I have CI build system builds an MSI whenever a developer checks in a change. We run automated acceptance tests on the installed MSI.
基本上每个 MSI 都是产品的完整安装,因此我们本身没有任何版本控制(ala Windows 安装程序)..
Basically every MSI is a complete install of the product, so we don't have any versioning (ala Windows installer) per se..
每个 MSI 具有相同的产品 GUID 和升级 GUID,以及相同的版本号.但具有不同的包 GUID(在 wix 中使用*").
Each MSI has the same product GUID and upgrade GUID, and the same version number. but has a different package GUID (use '*' in wix).
我想要实现的是,当安装程序运行时,它会卸载"任何以前安装的产品版本,然后安装新版本..所有这些都来自一个 MSI(我们有一个复杂的安装过程我们的控件.. citrix 和 sccm,所以我们想给它们一个简单的安装路径)
What I want to achieve is that when the installer runs, it will 'uninstall' any previously installed version of the product, and install the new one.. all from a single MSI (We have a convoluted install process that is out of our control.. citrix and sccm, so we want to give them a simple install path)
我试过了:
<Property Id='PREVIOUSVERSIONSINSTALLED' Secure='yes' />
<Upgrade Id='$UPGRADE_GUID'>
<UpgradeVersion Minimum='1.0.0.0'
Maximum='99.0.0.0'
Property='PREVIOUSVERSIONSINSTALLED'
IncludeMinimum='yes'
IncludeMaximum='no' />
</Upgrade>
并且有:
<InstallExecuteSequence>
<RemoveExistingProducts After='InstallFinalize' />
</InstallExecuteSequence>
并尝试过:
<InstallExecuteSequence>
<RemoveExistingProducts After='InstallInitialize' />
</InstallExecuteSequence>
但是当我尝试从后续版本安装 msi 时,我得到:
But when I try to install an msi from a subsequent build I get:
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.
这不是我真正想要的..
Which is not really what I was going for..
我知道我可以只更新产品标签中的版本属性,但这变得难以管理.首先,我一天可以生成 20 多个 msi 构建,因为我有许多生成 MSI 的构建管道,但我不确定如何以有意义的方式处理版本编号.
I understand that I can just update the Version attribute in the product tag, but that becomes difficult to manage. Firstly I can produce 20+ msi builds a day as I have a number of build pipelines that produce MSIs and am not sure how to handle the version numbering in a way that makes sense.
也许 Windows Installer 只是不允许这种总是覆盖安装的版本"安装?
Maybe Windows Installer just does not allow this type of 'always overwrite installed version' install?
推荐答案
所以我确实找到了一种无需更改版本号的方法.
So I did find a way of doing it without changing the version number.
我会在每次构建时更改产品 GUID,但保持升级 GUID 不变.
I change the Product GUID with every build, but keep the Upgrade GUID the same.
我还必须将 RemoveExistingProducts 更改为 Before='InstallInitialize'.否则,它只会在安装路径中的构建之间留下增量".
I also had to change the RemoveExistingProducts to Before='InstallInitialize'. Otherwise it left only the 'deltas' between builds in the install path.
正如下面 Wim 所指出的,我可以用 '*'
替换生成的产品 GUID.
As noted by Wim below, I can replace the generated Product GUID with '*'
.
这篇关于如何让 WIX MSI 始终删除以前的版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!