0

I have InstallShield product - setup.exe. This setup.exe is actually a bootstrapper of some kind that install a file called product.msi. I have the UpgradeCode of this product.msi thingy. So I should be able to make a Wix installer with MajorUpgrade element. But, it does not works - not all files are getting installed. Here is the link to the log.

Here are some suspect lines from the log:

MSI (s) (2C:F4) [22:47:19:663]: Note: 1: 2228 2:  3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 2911 
DEBUG: Error 2911:  Could not remove the folder C:\Config.Msi\.
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2911. The arguments are: C:\Config.Msi\, , 
MSI (s) (2C:F4) [22:47:19:667]: Note: 1: 2318 2:  

Here are the relevant parts of the wxs file:

<Product Id="*" Codepage="1252" Language="1033" Manufacturer="Intel Corporation"
           Name="TenLira" UpgradeCode="$(var.UpgradeCode)" Version="$(var.Version)">

    <Package Comments="Contact: Refael Sheinker, refael.sheinker@intel.com." Description="TenLira"
             InstallerVersion="500"
             Compressed="yes"
             InstallPrivileges="elevated"
             InstallScope="perMachine"
             Keywords="Installer,MSI,Database" Languages="1033" Manufacturer="Intel Corporation" Platform="x64" />

    <Property Id="REINSTALLMODE" Value="amos" />
    <Property Id="REBOOT" Value="ReallySuppress" />

    <Media Id="1" Cabinet="my_application.cab" EmbedCab="yes" />

    <MajorUpgrade AllowDowngrades="no"
                  AllowSameVersionUpgrades="yes"
                  Disallow="no"
                  IgnoreRemoveFailure="no"
                  MigrateFeatures="yes"
                  Schedule="afterInstallFinalize"
                  DowngradeErrorMessage="A later version of [ProductName] is already installed" />

Please advise. Thanks. Refael.

PhilDW
  • 20,260
  • 1
  • 18
  • 28
Refael Sheinker
  • 713
  • 7
  • 20

2 Answers2

1

When using the default MajorUpgrade element configuration you will default to uninstalling older product versions entirely before your new version is installed during a major upgrade. In technical terms: the positioning of RemoveExistingProduct changes in the InstallExecuteSequence (it is moved from after InstallFinalize to before InstallInitialize) - I verified that this indeed happens when you change the MajorUpgrade element to its default and most simple format - like you did).

Uninstalling early during a major upgrade will help eliminate any errors caused by faulty component references in the two setups. Such faulty component referencing can typically cause files to be missing after upgrades, or files have not been overwritten as expected (the latter is a larger issue relating to the dangerous REINSTALLMODE setting which affects file versioning rules). I will update this tomorrow with more details - I wrote a long answer that is too messy to post now.

For the record, your value for REINSTALLMODE (amos), appears to not be a valid parameter for REINSTALLMODE. Some people use amus to force overwrite files, but amos is simply incorrect parameters (letters a and o are in conflict - they define different behavior for the same thing). Using amus can cause a number of highly undesirable side-effects that I will try to explain tomorrow if I get the time.

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • **Using amus can cause a number of highly undesirable side-effects** - you are scaring me :-) that is the only thing that solves my problem. What side effects can it cause? – Refael Sheinker Feb 18 '18 at 08:09
  • 1
    Do you perhaps have a lot of unversioned files in your setup that need to be force overwritten (code sample files, IIS ASP files, etc...)? Or do you have the need to downgrade binaries (dll, exe, etc...) as well? – Stein Åsmul Feb 18 '18 at 14:31
  • Asmul, yes, I do have lots of versioned files (docs, text files, bmp and many more). They do need to be overwritten, they change with every release. I don't have need to downgrade binaries, maybe in the future, I want to leave the possibility. – Refael Sheinker Feb 18 '18 at 19:08
  • 2
    Refael, apologies, I am still working to provide a proper answer on why REINSTALLMODE="amus" is a dangerous feature - I need to do some testing to separate fact from fanboyisms (popularized faulty facts that are frequently stated, but not properly checked). Essentially you can downgrade system-wide shared files, cause an inconsistent version estate across shared binaries by installing downgrading packages out of sequence (older packages installed last), further you can wipe out settings and data files changed by the user, and there are a few other problems too. I will try to write it up later. – Stein Åsmul Feb 22 '18 at 01:29
0

Ok, ehhh... I don't know why, but changing the MajorUpgrade element to the following:

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

Solves the problem.

Refael Sheinker
  • 713
  • 7
  • 20
  • 1
    [**Maybe try to compare the two resultant MSI files (before and after your change) using an appropriate tool**](https://stackoverflow.com/a/48482546/129130) in order to see what is actually different in the files? It should suffice to compare the MSI files, but you can also decompile them using WiX's `dark.exe` and determine what WiX source differences there are (both approaches are described in the linked answer). I would try to get to the bottom of this to ensure the problem is really fixed - just my 2 cents. – Stein Åsmul Feb 18 '18 at 00:25
  • I don't understand. What to compare? I have wsx of both msi files. And the only difference is the MajorUpgrade element. The difference I made. – Refael Sheinker Feb 18 '18 at 08:30
  • 1
    Compare the actual, compiled MSI files using SuperOrca or InstEd or one of the other tools listed in the linked answer in my previous comment, and you will discover that RemoveExistingProducts has been moved before InstallInitialize as I explained in my answer. This greatly affects how the installation of your major upgrade happens. See if the answer I added makes sense (answer, not comment). I will get back to you later with more on REINSTALLMODE. – Stein Åsmul Feb 18 '18 at 14:29
  • 1
    It most likely works now because the default scheduling for major upgrade is afterInstallValidate, so the entire older product is now uninstalled first, and then the upgrade is installed. Previously, it was afterInstallFinalize, which is completely different as well as outside the transaction. It's not clear what the requirement for major upgrade was, but if it was to uninstall all the old setup first then the problem is solved. AfterInstallFinalize is hardly ever the right place. – PhilDW Feb 18 '18 at 19:29