0

We have a wix setup, which was working perfectly up until now. Recently we moved from Jenkins from Azure Devops for our CI, and some things have changed a tiny little bit(obfuscation, ...). But the whole wix solution didn't changed much(we had new features so we did add some components).

When doing the tests, we noticed that installing our new version(which is 5.1.2.x) on the top of a previous version(5.1.0) generated from jenkins, we get everything installed, no errors, only one setup, but in the install folder, some of the DLL we include in our setups(seems to be always the same) are missing(and obviously, we can't run properly our apps).

We declare the product like this:

  <Product Id="*"
           Codepage="1252"
           Language="1033"
           Manufacturer="$(var.MANUFACTURER)"
           Name="$(var.PRODUCTNAME)"
           UpgradeCode="705E9C74-7192-4F74-B7A4-4DE9428B6FFA"
           Version="$(var.ProductVersion)">

And we have this as upgrade:

<MajorUpgrade Schedule="afterInstallValidate" DowngradeErrorMessage="!(loc.DOWNGRADE_ERROR_MESSAGE)" />
<Upgrade Id="705E9C74-7192-4F74-B7A4-4DE9428B6FFA">
  <!--This is necessary to allow upgrading daily builds which will have all the same version but different product id 
    Ignore the ICE warning on compilation for this issue (the warning can be suppressed too)-->
  <UpgradeVersion Property="INSTALLED_PRODUCT_CODES" IncludeMinimum="yes" Minimum="2.12.7" IncludeMaximum="yes" Maximum="$(var.ProductVersion)"/>
</Upgrade>

What we have confirmed so far:

  • Uninstalling the 5.1.0 manually and installing the 5.1.2 works
  • Installing only the 5.1.2 works
  • Installing the 5.1.2 over the 5.1.0 removes some files

I've tried to move the MajorUpgrade at the afterInstallFinalize step, it asks to uninstall the 5.1.0 first and to launch again. BUT, the uninstallation fails. For what I see, I think the 5.1.2 setup has already copied some of new files?

So my question:

  • How to force a full uninstall before anything gets installed from the new version
  • Is there a way to say this full uninstall is only required from going to a version that is <=5.1.0 ?
J4N
  • 19,480
  • 39
  • 187
  • 340

2 Answers2

0

I've no idea why, but adding this to my Product.wxs solved it:

<Property Id="REINSTALLMODE" Value="dmus"/>

It basically tells wix to install the DLL no matter if they are considered older or newer.

More information about the reinstallmode can be found here: https://learn.microsoft.com/en-us/windows/win32/msi/reinstallmode

The default value is omus, which implies "Reinstall if the file is missing or is an older version."

Not sure why my DLL were not considered "missing or older" but where nowhere to be found after the setup.

J4N
  • 19,480
  • 39
  • 187
  • 340
0

Microsoft Docs: Why Windows Installer removes files during a major upgrade if they go backwards in version numbers


This is a common problem and is caused by a few different things. Usually:

  1. Downgrading versioned files. This can result in files being missing after the update as the file scan (costing) records that files should never be downgraded (but the upgrade process still deletes the old files, without installing the new ones - quite a bug).

  2. Inconsistent component GUIDs across setup versions. On component reference counting. This can also cause files to be missing after update, but for a different reason: the new setup does not understand that the file is the same as before - just a new version of it - since it has a "new identity" in the form of a new GUID - hence it gets removed by mistake. A case of "mistaken identity".

Since your tweak to REINSTALLMODE worked (skim that link please), it is probably the first issue. This tweak will overwrite files regardless of version - which is not generally a good idea. You can check this answer for information and the suggestion to use companion files to solve the problem.

Fixes for issue 1 include 1) using component files, 2) hacking the version number higher in affected files, 3) some try to move RemoveExistingFiles before CostFinalize, but this does not really work and isn't valid by documentation, and 4) "version lying" as they call it - setting a fake version for the file in the MSI (used in InstallShield). And 5) Modify REINSTALLMODE - and this is bad (section "Several Problems") because it affects the whole setup and could overwrite shared files and create inconsistent file versions (some files updated, some downgraded if setups interfere). 6) You can also install the file with a new name or in another location. Then you should change the component GUID (here is why - component GUID reference counts an absolute path - the GUID doesn't follow the file around if it moves - with a new GUID it has a "new identity").

The fix for issue 2 is to either keep component GUIDs consistent across releases, or to move the standard action RemoveExistingProducts early in the InstallExecuteSequence so the whole product is fully uninstalled before the new one is installed. It effectively de-couples the setups from any component reference errors - or any other past sins. Clean slate.

Please see these previous answers:


Links:

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • Thanks for the answer. I'm not sure to understand what you mean by your solution 1), the version is coming from azure, before it was 5.0.0.10xxx and now it is 5.1.2.15xxx, so it should already be considered as higher, right? Also, the problem was mostly on external DLL which haven't changed. So except the solution 5)(which is not ideal), I don't see what I can do. – J4N Feb 05 '21 at 05:41
  • [Companion Files](https://learn.microsoft.com/en-us/windows/win32/msi/companion-files) is the MSI feature which makes your file be overwritten by "following the version of another file". [See the "Companion Files" section here](https://stackoverflow.com/a/60854570/129130). In short: your file replacement is determined by the file you point to - and not the file's own version. "Follow that file". – Stein Åsmul Feb 05 '21 at 12:15
  • Are you deploying as a patch or as a full MSI package? – Stein Åsmul Feb 05 '21 at 12:18