1
votes

Under "Add or remove programs" i can see five versions:

- 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

when trying to install ApplicationName v3.0.5.30 all previous versions are NOT deleted. Versions that stays are:

- ApplicationName v3.0.4.0
- ApplicationName v3.0.4.18

I already read all about on How to implement WiX installer upgrade?

Code that i use is:

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

What i am doing wrong?

I also tryed to build version v3.0.6.0 and after install i got the same result.

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

UpgradeCode is the same for all versions, i looked with Orca image

Last UpgradeCode on image is for version 3.0.6.0

1
Is the actual value of $(var.UpgradeCode) stable between versions? Run the installation with verbose logging enabled (msiexec -i setup.msi -l*v log.txt), to see if PREVIOUSVERSIONSINSTALLED gets set as you expect.zett42
BTW, your ProductVersion must increment in one of the first 3 numbers to trigger a major upgrade (this is a "feature" of MSI). E. g. 3.0.4.0 -> 3.0.4.18 won't trigger major upgrade, but 3.0.4.18 -> 3.0.5.27 does.zett42
added extra info to question, since response was ProductVersion is not using fourt number to trigger updateMartin86
You still didn't answer, whether the UpgradeCode is the same for all versions. Most likely it was different for the v3.0.4.x series. If this is true, you have to add a 2nd Upgrade element with the UpgradeCode of v3.0.4.x. @SteinÅsmul gives some hints in his answer, how to find the UpgradeCode of installed MSIs. You could also open a 3.0.4.x MSI file in Orca and copy the UpgradeCode from the Property table.zett42
It's the same UpgradeCode for all versionsMartin86

1 Answers

1
votes

Ignoring Digits: Extract from the MSI SDK documentation for the ProductVersion property:

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


In order to get rid of installations in the wild, there are a few approaches.

Uninstall By Product Code: I would just get a list of product codes and uninstall corporate-wide if you are delivering an in-house application: How can I find the product GUID of an installed MSI setup? The list of product codes you assemble can then be passed to msiexec.exe /x {productcode} as explained in section 3 here. Just a simple batch file. Or you can try WMI, or one of the other approaches.

Uninstall By Upgrade Code: You can check if all your setup versions share the same upgrade code by using the code from here: How can I find the Upgrade Code for an installed MSI file? (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).

Uninstall By Product Name: You can uninstall by product name matching as well. Some samples here (VBScript): Is there an alternative to GUID when using msiexec to uninstall an application?. And here is a .NET DTF uninstall function: Uninstalling program (distinctively simplistic, needs tweaking for real-world use).


Some Links: