[wix-users] Force overwrite of specific binaries that have a lower version than the previous version installed (doing upgrade)

Steven Ogilvie stogilvie at genetec.com
Wed Jun 22 10:13:45 PDT 2022


So using REINSTALLMODE did not work… here is what I ended up doing:

SetProperty and setting REINSTALLMODE to amus/dmus/ecmus <result, didn't work>
Creating a custom action to set the REINSTALLMODE to amus/dmus/ecmus <result, didn't work>
I tried setting REINSTALLMODE before RemoveExistingProducts and after FindRelatedProducts but that didn’t help.

Then I set the file "File.With.Lower.Version.dll" as a CompanionFile for "File.With.Higher.Version.dll" <result, WORKED!>

i.e.:

<Component Id="comp_File.With.Higher.Version.dll" Guid="*">
                <File Id="file_File.With.Higher.Version.dll" KeyPath="yes" Source="$(var.InstallSource)\File.With.Higher.Version.dll"/>
</Component>
<Component Id="comp_File.With.Lower.Version.dll" Guid="{1DF2A3CF-123-1A2B-4567-A40F567C8CC9}" KeyPath="yes">
                <File Id="file_File.With.Lower.Version.dll" KeyPath="no" CompanionFile="file_File.With.Higher.Version.dll" Source="$(var.InstallSource)\File.With.Lower.Version.dll"/>
</Component>

Cheers,

Steve

From: Hoover, Jacob <Jacob.Hoover at greenheck.com>
Sent: June 15, 2022 5:39 PM
To: Steven Ogilvie <stogilvie at genetec.com>
Subject: RE: Force overwrite of specific binaries that have a lower version than the previous version installed (doing upgrade)

https://docs.microsoft.com/en-us/archive/blogs/astebner/why-windows-installer-removes-files-during-a-major-upgrade-if-they-go-backwards-in-version-numbers<https://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Farchive%2Fblogs%2Fastebner%2Fwhy-windows-installer-removes-files-during-a-major-upgrade-if-they-go-backwards-in-version-numbers&data=05%7C01%7Cstogilvie%40genetec.com%7C8c820224afac41bae12908da4f176a03%7C7ba8d2fb46604a19802e4d015a17e167%7C0%7C0%7C637909260151088933%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=2YIxmIsLbvO1lVGnSrK0hh29cDIcqxC2Zf%2BwYWMf%2Fb0%3D&reserved=0>

They suggest RemoveExistingProducts Before="CostInitialize, but MS advice differs: https://docs.microsoft.com/en-us/windows/win32/msi/removeexistingproducts-action?redirectedfrom=MSDN<https://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fwin32%2Fmsi%2Fremoveexistingproducts-action%3Fredirectedfrom%3DMSDN&data=05%7C01%7Cstogilvie%40genetec.com%7C8c820224afac41bae12908da4f176a03%7C7ba8d2fb46604a19802e4d015a17e167%7C0%7C0%7C637909260151088933%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=wa3uKU30NEo7MiR46aphfaiBBDN%2Bc1HZ91IJwwe0irM%3D&reserved=0>

And some legacy references here.. https://sourceforge.net/p/wix/mailman/wix-users/?viewmonth=201406&viewday=2<https://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsourceforge.net%2Fp%2Fwix%2Fmailman%2Fwix-users%2F%3Fviewmonth%3D201406%26viewday%3D2&data=05%7C01%7Cstogilvie%40genetec.com%7C8c820224afac41bae12908da4f176a03%7C7ba8d2fb46604a19802e4d015a17e167%7C0%7C0%7C637909260151245160%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=RYbgwnX0rG6mNNAIAl6cM5Btq%2F46UCkIYjSO2F8Go48%3D&reserved=0>


And some searching on Version Lying, which is what install shield is doing, https://wix-users.narkive.com/FNZKulaw/always-overwrite-use-versioning-rules-per-file-basis<https://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwix-users.narkive.com%2FFNZKulaw%2Falways-overwrite-use-versioning-rules-per-file-basis&data=05%7C01%7Cstogilvie%40genetec.com%7C8c820224afac41bae12908da4f176a03%7C7ba8d2fb46604a19802e4d015a17e167%7C0%7C0%7C637909260151245160%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=mVUG1IBhmeGq%2Bj%2B9crFE8M0cP3gayU%2FsFUs14e0PQAo%3D&reserved=0>

Basically they just hack the 2 files version info in the MSI, and assign it a version of 65535.65535.65535.65535
From: Steven Ogilvie <stogilvie at genetec.com<mailto:stogilvie at genetec.com>>
Sent: Wednesday, June 15, 2022 3:47 PM
To: Hoover, Jacob <Jacob.Hoover at greenheck.com<mailto:Jacob.Hoover at greenheck.com>>
Subject: RE: Force overwrite of specific binaries that have a lower version than the previous version installed (doing upgrade)

Yes ProductCode and Version number is changed each build…

From: Hoover, Jacob <Jacob.Hoover at greenheck.com<mailto:Jacob.Hoover at greenheck.com>>
Sent: June 15, 2022 4:45 PM
To: Steven Ogilvie <stogilvie at genetec.com<mailto:stogilvie at genetec.com>>
Subject: RE: Force overwrite of specific binaries that have a lower version than the previous version installed (doing upgrade)

Confirm that you are changing your product code every time you are building your install.

From: Steven Ogilvie <stogilvie at genetec.com<mailto:stogilvie at genetec.com>>
Sent: Wednesday, June 15, 2022 2:46 PM
To: Hoover, Jacob <Jacob.Hoover at greenheck.com<mailto:Jacob.Hoover at greenheck.com>>
Subject: RE: Force overwrite of specific binaries that have a lower version than the previous version installed (doing upgrade)

Yes we do only Major upgrades, but  I see this happening in some installers. i.e.

Installer version 1.0.0.0<https://can01.safelinks.protection.outlook.com/?url=http%3A%2F%2F1.0.0.0%2F&data=05%7C01%7Cstogilvie%40genetec.com%7C8c820224afac41bae12908da4f176a03%7C7ba8d2fb46604a19802e4d015a17e167%7C0%7C0%7C637909260151245160%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=RsrDOwBT7TBm0UDcA7mDK%2B1N8o9HSfHqmrnLVa1heN8%3D&reserved=0> that has 1 or more files that have a version of say 5.0.20.0<https://can01.safelinks.protection.outlook.com/?url=http%3A%2F%2F5.0.20.0%2F&data=05%7C01%7Cstogilvie%40genetec.com%7C8c820224afac41bae12908da4f176a03%7C7ba8d2fb46604a19802e4d015a17e167%7C0%7C0%7C637909260151245160%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=UaGX16OHwZCGda0I3PXWVoSjRt%2FK8pKXm1QBGsphQgg%3D&reserved=0> (client installs as a fresh install)
Then they upgrade to version 1.1.0.0<https://can01.safelinks.protection.outlook.com/?url=http%3A%2F%2F1.1.0.0%2F&data=05%7C01%7Cstogilvie%40genetec.com%7C8c820224afac41bae12908da4f176a03%7C7ba8d2fb46604a19802e4d015a17e167%7C0%7C0%7C637909260151245160%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=2tgvGy9%2BZKFm4FtaGeaFCDmx%2FK%2B%2FaF%2BERWwFxyVsXO8%3D&reserved=0> and 1 or more files have a lower version of 5.0.17.0<https://can01.safelinks.protection.outlook.com/?url=http%3A%2F%2F5.0.17.0%2F&data=05%7C01%7Cstogilvie%40genetec.com%7C8c820224afac41bae12908da4f176a03%7C7ba8d2fb46604a19802e4d015a17e167%7C0%7C0%7C637909260151245160%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=ElAakGF2Eh2W82aBDCSlhsHzZDqX0OVdpkO9WrWreXI%3D&reserved=0>, those 1 or more files are not copied during the upgrade because  the “newer” file has an older version.

And by default REINSTALLMODE=omus

Which the “o” stands for: “Reinstall if the file is missing or is an older version.” Which the file is not, it is older than the file that was originally there.

Wouldn’t changing REINSTALLMODE=dmus where d is: “Reinstall if the file is missing or a different version is present.”?


Steve
PS. I have a bug for a few applications from the same team that after an upgrade 1 or 2 files are missing and they have determined that the actual version of the DLL’s are  higher in the lower version of the install, and the newer install has those files with a lesser version…
PPS. In InstallShield you can actually right click on a file and goto properties and select “Always overwrite” checkbox which solves the problem…
We have a few installers that have not yet been converted to WiX yet

From: Hoover, Jacob <Jacob.Hoover at greenheck.com<mailto:Jacob.Hoover at greenheck.com>>
Sent: June 15, 2022 3:37 PM
To: Steven Ogilvie <stogilvie at genetec.com<mailto:stogilvie at genetec.com>>
Subject: RE: Force overwrite of specific binaries that have a lower version than the previous version installed (doing upgrade)

Are you doing minor upgrades?  Because a major upgrade, when scheduled early, should remove the old product before installing the new.  As such, the files should apply fine. (Minor upgrades and patches would not work.)

https://docs.microsoft.com/en-us/windows/win32/msi/major-upgrades<https://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fwin32%2Fmsi%2Fmajor-upgrades&data=05%7C01%7Cstogilvie%40genetec.com%7C8c820224afac41bae12908da4f176a03%7C7ba8d2fb46604a19802e4d015a17e167%7C0%7C0%7C637909260151245160%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=ekknhMzgv3aLmACKsQ6zBMjqwG5QbU8zrZ4V9I23y0w%3D&reserved=0>

From: Steven Ogilvie <stogilvie at genetec.com<mailto:stogilvie at genetec.com>>
Sent: Wednesday, June 15, 2022 2:33 PM
To: Hoover, Jacob <Jacob.Hoover at greenheck.com<mailto:Jacob.Hoover at greenheck.com>>
Subject: RE: Force overwrite of specific binaries that have a lower version than the previous version installed (doing upgrade)

Sorry should have put this in the reply email…

This is what our Products.wxs looks like for all of your WiX MSI’s (except for a few minor things like var.<something> where the <something> is our product name (can be abbreviated)

“<?xml version="1.0" encoding="UTF-8"?>
<!--DEV: DO NOT MODIFY-->
<Wix xmlns=http://schemas.microsoft.com/wix/2006/wi<https://can01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fschemas.microsoft.com%2Fwix%2F2006%2Fwi&data=05%7C01%7Cstogilvie%40genetec.com%7C8c820224afac41bae12908da4f176a03%7C7ba8d2fb46604a19802e4d015a17e167%7C0%7C0%7C637909260151245160%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=CKSOqHuqAtXcjAmEZJjxzwBf40q%2B%2B1zonQo2n0qkaoE%3D&reserved=0> xmlns:util=http://schemas.microsoft.com/wix/UtilExtension<https://can01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fschemas.microsoft.com%2Fwix%2FUtilExtension&data=05%7C01%7Cstogilvie%40genetec.com%7C8c820224afac41bae12908da4f176a03%7C7ba8d2fb46604a19802e4d015a17e167%7C0%7C0%7C637909260151245160%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=G2TALEmVrr2lLD2wiwldH29o6IiO3POowu%2BYg4QlmBQ%3D&reserved=0>>
    <?include $(var.ProjectDir)\Includes\Variables.wxi?>
    <Product Id="$(var.ProductCode)"
             Name="$(var.AODB)"
             Language="1033"
             Version="$(var.ProductVersion)"
             Manufacturer="$(var.Manufacturer)"
             UpgradeCode="$(var.UpgradeCode)"
             Codepage="Windows-1252">
        <Package
            InstallerVersion="405"
            Compressed="yes"
            Languages="0,1033"
            Keywords="Installer,MSI,Database"
            Manufacturer="$(var.Manufacturer)"
            Description="$(var.AODB)"
            SummaryCodepage="Windows-1252"
            InstallPrivileges="elevated"
            InstallScope="perMachine" />

        <MajorUpgrade
            DowngradeErrorMessage="A newer version of [ProductName] is already installed." />

        <MediaTemplate EmbedCab="yes" CompressionLevel="high"/>

        <FeatureGroupRef Id="PluginFeatures" />

        <Property Id="ARPNOMODIFY" Value="1"/>
        <Property Id="ARPSYSTEMCOMPONENT" Value="1" />
        <Property Id="ARPPRODUCTICON" Value="GENETEC.Icon" />
        <Icon Id="GENETEC.Icon" SourceFile="$(var.SolutionDir)..\..\Icons\Prod.ico" />
        <Property Id="MSIENFORCEUPGRADECOMPONENTRULES" Value="1" />”

Steve


From: Hoover, Jacob <Jacob.Hoover at greenheck.com<mailto:Jacob.Hoover at greenheck.com>>
Sent: June 15, 2022 3:29 PM
To: Steven Ogilvie <stogilvie at genetec.com<mailto:stogilvie at genetec.com>>
Subject: RE: Force overwrite of specific binaries that have a lower version than the previous version installed (doing upgrade)

https://wixtoolset.org/documentation/manual/v3/xsd/wix/majorupgrade.html<https://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwixtoolset.org%2Fdocumentation%2Fmanual%2Fv3%2Fxsd%2Fwix%2Fmajorupgrade.html&data=05%7C01%7Cstogilvie%40genetec.com%7C8c820224afac41bae12908da4f176a03%7C7ba8d2fb46604a19802e4d015a17e167%7C0%7C0%7C637909260151245160%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=HVknI6AY070twidDu%2F854OzT981zniHtYqgBqqf4Fe4%3D&reserved=0>


From: Steven Ogilvie <stogilvie at genetec.com<mailto:stogilvie at genetec.com>>
Sent: Wednesday, June 15, 2022 2:25 PM
To: Hoover, Jacob <Jacob.Hoover at greenheck.com<mailto:Jacob.Hoover at greenheck.com>>
Subject: RE: Force overwrite of specific binaries that have a lower version than the previous version installed (doing upgrade)

Hey Jacob,

Our default upgrade scheme is:
“<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />”

This actually sets RemoveExistingProducts BEFORE InstallInitialize, (all of our MSI’s created with WiX are using this, so sigh, that doesn’t help ☹

Steve



From: Hoover, Jacob <Jacob.Hoover at greenheck.com<mailto:Jacob.Hoover at greenheck.com>>
Sent: June 15, 2022 2:05 PM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org<mailto:wix-users at lists.wixtoolset.org>>
Cc: Steven Ogilvie <stogilvie at genetec.com<mailto:stogilvie at genetec.com>>
Subject: RE: Force overwrite of specific binaries that have a lower version than the previous version installed (doing upgrade)

Schedule RemoveExistingProducts earlier? Ex: Before='InstallInitialize'

From: wix-users <wix-users-bounces at lists.wixtoolset.org<mailto:wix-users-bounces at lists.wixtoolset.org>> On Behalf Of Steven Ogilvie via wix-users
Sent: Wednesday, June 15, 2022 10:47 AM
To: wix-users at lists.wixtoolset.org<mailto:wix-users at lists.wixtoolset.org>
Cc: Steven Ogilvie <stogilvie at genetec.com<mailto:stogilvie at genetec.com>>
Subject: [wix-users] Force overwrite of specific binaries that have a lower version than the previous version installed (doing upgrade)
Importance: High

Hello,

I remember doing this 'fix' in a previous company but for the life of me I can't remember what was done.

Background:

Client installs version 1.0.0.0<https://can01.safelinks.protection.outlook.com/?url=http%3A%2F%2F1.0.0.0%2F&data=05%7C01%7Cstogilvie%40genetec.com%7C8c820224afac41bae12908da4f176a03%7C7ba8d2fb46604a19802e4d015a17e167%7C0%7C0%7C637909260151245160%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=RsrDOwBT7TBm0UDcA7mDK%2B1N8o9HSfHqmrnLVa1heN8%3D&reserved=0> of product, a couple of DLL's are version 5.0.20.0<https://can01.safelinks.protection.outlook.com/?url=http%3A%2F%2F5.0.20.0%2F&data=05%7C01%7Cstogilvie%40genetec.com%7C8c820224afac41bae12908da4f176a03%7C7ba8d2fb46604a19802e4d015a17e167%7C0%7C0%7C637909260151245160%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=UaGX16OHwZCGda0I3PXWVoSjRt%2FK8pKXm1QBGsphQgg%3D&reserved=0> (not our DLL's)

Then client upgrades to version 1.1.0.0<https://can01.safelinks.protection.outlook.com/?url=http%3A%2F%2F1.1.0.0%2F&data=05%7C01%7Cstogilvie%40genetec.com%7C8c820224afac41bae12908da4f176a03%7C7ba8d2fb46604a19802e4d015a17e167%7C0%7C0%7C637909260151245160%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=2tgvGy9%2BZKFm4FtaGeaFCDmx%2FK%2B%2FaF%2BERWwFxyVsXO8%3D&reserved=0> of our product, but a couple of the DLL's are version 5.0.17.0<https://can01.safelinks.protection.outlook.com/?url=http%3A%2F%2F5.0.17.0%2F&data=05%7C01%7Cstogilvie%40genetec.com%7C8c820224afac41bae12908da4f176a03%7C7ba8d2fb46604a19802e4d015a17e167%7C0%7C0%7C637909260151245160%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=ElAakGF2Eh2W82aBDCSlhsHzZDqX0OVdpkO9WrWreXI%3D&reserved=0> (not our DLL's) and the 2 DLL's are not copied over (our upgrades are major upgrades, i.e. uninstall old, install new).

A few of our MSI's in other products we are using InstallShield, and in InstallShield you can right click on a file and select from the Properties dialog "Always overwrite" checkbox which forces the file to be overwritten regardless of version or date.

Solution: ?

However, you can't really do that in WiX, I think the only way to 'fix' the issue is to change:

REINSTALLMODE=omus (default) to either
REINSTALLMODE=amus or REINSTALLMODE=dmus

Is this the *ONLY* available workaround?

Thank you,

Steve


Steven Ogilvie
Software Developer, SCMT - Builds & Installers

Confidentiality Message * This e-mail message is confidential, may be privileged and is intended for the exclusive use of the addressee. Any other person is strictly prohibited from disclosing, distributing or reproducing it. If the addressee cannot be reached or is unknown to you, please inform the sender by return e-mail immediately and delete this e-mail message and destroy all copies.


____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/<https://can01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.firegiant.com%2F&data=05%7C01%7Cstogilvie%40genetec.com%7C8c820224afac41bae12908da4f176a03%7C7ba8d2fb46604a19802e4d015a17e167%7C0%7C0%7C637909260151245160%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=RFOaUAYny3PloCejdKCt%2FqnB9z6Bk7CpgHZ2qgt%2FfyE%3D&reserved=0>
NOTE: This email was received from an external source. Please use caution when opening links or attachments in the message.
NOTE: This email was received from an external source. Please use caution when opening links or attachments in the message.
NOTE: This email was received from an external source. Please use caution when opening links or attachments in the message.
NOTE: This email was received from an external source. Please use caution when opening links or attachments in the message.
NOTE: This email was received from an external source. Please use caution when opening links or attachments in the message.


More information about the wix-users mailing list