Question

I have a product to which I am creating an upgrade to. Now I have updated the App code , and not the upgrade code to let it work as an upgrade.

I am not using MajorUpgrade tag in WIX xml as of now.

The following configuration uninstalls any previous configuration and installs the newer files to the directory, but it is installing only those files which has changed version number.

<Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
<Upgrade Id="$(var.SleakSoft_UpgradeCode)">
 <UpgradeVersion Minimum="4.12.0" Maximum="$(var.SleakSoft_AppVersion)" Property="OLDERVERSIONBEINGUPGRADED" OnlyDetect="no" IncludeMinimum="yes" IncludeMaximum="no" />
  <UpgradeVersion Minimum="$(var.SleakSoft_AppVersion)" IncludeMinimum="yes" OnlyDetect="yes" Language="!(loc.LANG)" Property="NEWPRODUCTFOUND" />
  <UpgradeVersion Minimum="4.12.0" Maximum="5.0.0" OnlyDetect="no" Language="!(loc.LANG)" IncludeMaximum="yes" Property="UPGRADEFOUND" />
</Upgrade>  
<CustomAction Id="PreventDowngrading" Error="Newer version of Sleak Talk is already installed." />
  <InstallExecuteSequence>
  <Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
  <RemoveExistingProducts After="InstallInitialize"  />
</InstallExecuteSequence>

Now How can I make it install all the files in installer after it removes the existing product.

I have already tried InstallExecure After="RemoveExistingProducts" and InstallExecuteAgain After="RemoveExistingProduct" but no luck.

Was it helpful?

Solution 2

Okay I tried it but for now the hot fix which worked for me is forcefully reinstall every thing when done with uninstalling.

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

The overriding throws a warning while building the WIX project. Property ID is a child of "Product" tag.

And as the Mirosoft WIX documentation said

Be aware how the Windows Installer applies the File Versioning Rules when Replacing Existing Files. The Windows Installer first determines whether the component's key file is already installed before attempting to install any of the files of the component. If the installer finds a file with the same name as the component's key file installed in the target location, it compares the version, date, and language of the two key files and uses file versioning rules to determine whether to install the component provided by the package. If the installer determines it needs to replace the component base upon the key file, then it uses the file versioning rules on each installed file to determine whether to replace the file.

Hence left with no choice, but to forcefully over write that.

OTHER TIPS

The right answer is after InstallInitialize, but if that doesn't work then you've got bigger problems. For example, if you tried that and it only installed newer files with higher versions then your major upgrade logic is incorrect by definition because that WILL uninstall the older product before installing the newer one. So maybe you're not detecting the older product. These are the rules, assuming you have a proper upgrade detection mechanism in your MSI file:

New ProductCode and PackageCode. Same UpgradeCode. Increment ProductVersion in the first three digits.

and a per user install will not upgrade a per machine and vice versa, and I don't think you can upgrade a 32 bit product with a 64-bit newer product.

Do a verbose log and see what's happening at the FindRelatedProducts actions, look for comments about detected products.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top