WIX (remove all previous versions)
Asked Answered
V

1

1

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

Vanpelt answered 18/7, 2018 at 14:12 Comment(13)
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.Paragraph
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.Paragraph
added extra info to question, since response was ProductVersion is not using fourt number to trigger updateVanpelt
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.Paragraph
It's the same UpgradeCode for all versionsVanpelt
OK, so the reason must be something else. Have you created a verbose log to see if there is anything strange? Can you manually uninstall v3.0.4.0 and v3.0.4.18?Paragraph
I can manualy uninstall (it works). What is verbose log ? Can you give me a link where i could see example of correct implemetation (.wxs file from VisualStudio)Vanpelt
Verbose log is most detailed installation log, you can get it by running this command-line: msiexec -i setup.msi -l*v log.txt. Look for log entries around AppSearch and PREVIOUSVERSIONSINSTALLED. Your Upgrade element should work, although you are also replacing newer versions instead of showing a message that a newer version is already installed. Allowing downgrades is bad practice (code from this answer would be better) unless you have very good reasons to do so.Paragraph
i made new test, i builded versions v3.0.4 v3.0.5 v3.0.6 v3.0.7 it looks like it always uninstal only ONE of previous versions. Is it posible to put some kind of loop in wix to uninstall all?Vanpelt
That shouldn't be necessary. WiX adds the RemoveExistingProducts action, which "removes the products in sequence by invoking concurrent installations". Look into the verbose log to see what is preventing the installer from doing that.Paragraph
It looks like one of previous versions was not uninstalled correctly. FROM LOG FILE: A newer version of this software is already installed. MSI (s) (20:04) [12:54:00:123]: Note: 1: 2205 2: 3: Error MSI (s) (20:04) [12:54:00:123]: Note: 1: 2228 2: 3: Error 4: SELECT Message FROM Error WHERE Error = 1709 MSI (s) (20:04) [12:54:00:123]: Product: AppName (v3.0.5.30) -- A newer version of this software is already installed.Vanpelt
I remember that i made version 3.0.5.30 and made a mistake in it by detecting newer version. And when trying to uninstall i got error "a new version of this software is already installed", because of that i was forced to uninstall it by register. Now i don't see this version anywhere and i can't uninstall it, all i have is Property(N): ProductCode = {B6C2C6BC-BFA5-494D-AE5F-4BF04A06E607} and when trying to uninstall msiexec /x {B6C2C6BC-BFA5-494D-AE5F-4BF04A06E607} i get same message, "a new version of ...."Vanpelt
Uninstal from this link has helped superuser.com/a/498058Vanpelt
A
3

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:

Abana answered 18/7, 2018 at 22:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.