1

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.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
  • I'm not sure that I follow: You want to do a major upgrade but you don't wan't to use `MajorUpgrade`? Or do you want some other type of [upgrade](http://msdn.microsoft.com/en-us/library/aa370579(v=vs.85).aspx)? – Tom Blodget Apr 18 '14 at 15:25
  • @TomBlodget: I have no problems using MajorUpdate, but as I am new to WIX I have tried a combination of that schedule="afterInstallInitialize" : this actually uninstalled the current installed version but just installed newer files from installer. Another option I have used with MajorUpgrade is after InstallFinalize" but more over behavior is not expected, it just replaced the files with greater version. In my installer there are some files which have same version number but as they contains some bug fixes the file size has been changes. – Anurag Choudhary Apr 18 '14 at 16:54

2 Answers2

0

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.

PhilDW
  • 20,260
  • 1
  • 18
  • 28
0

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.

  • I would NOT recommend this approach. It force overwrites ANY file on the target system that the setup contains- if you include merge modules this may include system files. In earlier versions of Windows this may downgrade system files, and on later versions a runtime error may result. – Stein Åsmul Apr 24 '14 at 01:12