Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
873 views
in Technique[技术] by (71.8m points)

windows installer - How do I make a WIX MSI always remove a previous version?

I have CI build system builds an MSI whenever a developer checks in a change. We run automated acceptance tests on the installed MSI.

Basically every MSI is a complete install of the product, so we don't have any versioning (ala Windows installer) per se..

Each MSI has the same product GUID and upgrade GUID, and the same version number. but has a different package GUID (use '*' in wix).

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)

I have tried:

<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>

and have:

<InstallExecuteSequence>
  <RemoveExistingProducts After='InstallFinalize' />
</InstallExecuteSequence>

and have tried:

<InstallExecuteSequence>
  <RemoveExistingProducts After='InstallInitialize' />
</InstallExecuteSequence>

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..

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.

Maybe Windows Installer just does not allow this type of 'always overwrite installed version' install?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

So I did find a way of doing it without changing the version number.

I change the Product GUID with every build, but keep the Upgrade GUID the same.

I also had to change the RemoveExistingProducts to Before='InstallInitialize'. Otherwise it left only the 'deltas' between builds in the install path.

As noted by Wim below, I can replace the generated Product GUID with '*'.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...