benb
Posts: 5
Joined: Wed Jun 13, 2007 8:53 am

Always update, regardless of version number.

I'm currently using the following work around to be able to always install my product, regardless of the version number (older or newer than current version).

* Allow side by side
* Upgrade code [|UpgradeCode]
* Min Version: 0.0.1
* Include min version in range: Yes

* CostFinalize Custom Action, AI_UPGRADE - yes

Is this still the only way to achieve this? I want to be able to let users downgrade if they wish, and always overwrite the previous installation.

This seems to work but I have a few problems:
* Often getting the message 'product already installed' (when this is the exact problem i'm trying to avoid). If I am testing an installer, I can only run it once before I get this message. Do I really have to generate a new product code when I try a new build (or uninstall the package each time)?
* Some files don't always get updated, some files have version numbers, most don't. Regardless of the version number, I always want all files to be copied.

I'd really appreciate some help, it seems like I want to do the most basic of tasks (simply copying files, regardless of version number), but it feels like I'm doing something unusual!?

Cheers
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Hi Ben,

The method you are currently using relies on using the File Versioning Rules to replace the existing files and thus it will not work consistently.

http://msdn2.microsoft.com/en-US/library/aa368599.aspx

You should use a different method which conforms to the Windows Installer rules and best practices: each MSI package will remove an older version (upgrade) and also a newer version (downgrade).

Since AI does not fully support editing the Upgrades you will need to modify the AIP file manually and also edit the generated MSI file in Orca, as described below.

I would suggest that you follow the steps below starting with a new project and then implement the described method in your own project.

1. In the Upgrades page, make sure that the versioning method is set to "Automatically upgrade older product versions". Save the AIP file.

2. Open the AIP file in a text editor and locate the "MsiUpgradeComponent":

Code: Select all

<COMPONENT cid="caphyon.advinst.msicomp.MsiUpgradeComponent">
  <ROW UpgradeCode="[|UpgradeCode]" VersionMax="[|ProductVersion]" Attributes="1025" ActionProperty="OLDPRODUCTS"/>
  <ROW UpgradeCode="[|UpgradeCode]" VersionMin="[|ProductVersion]" Attributes="2" ActionProperty="AI_NEWERPRODUCTFOUND"/>
</COMPONENT>
3. In the second row (that sets the AI_NEWERPRODUCTFOUND Property), change the value for the "Attributes" attribute to "1025", such that when a newer product is found it will be removed - this will allow the downgrade. Hence, the "MsiUpgradeComponent" will become:

Code: Select all

<COMPONENT cid="caphyon.advinst.msicomp.MsiUpgradeComponent">
  <ROW UpgradeCode="[|UpgradeCode]" VersionMax="[|ProductVersion]" Attributes="1025" ActionProperty="OLDPRODUCTS"/>
  <ROW UpgradeCode="[|UpgradeCode]" VersionMin="[|ProductVersion]" Attributes="1025" ActionProperty="AI_NEWERPRODUCTFOUND"/>
</COMPONENT>
4. Save the AIP file as UTF-8.

5. Suppose that this is the project file for version 1.0.0 of your application. In order to create the project for the next version (for instance, 2.0.0) you will increase the Product Version in the Product Details page and answer "Yes" when asked to generate a new ProductCode.

6. In order to allow downgrading, the "AI_DOWNGRADE" Error Message Custom Action must be removed from MSI packages and you will need to use Orca in order to achieve this. Do the following:

a) Open one of the MSI packages in Orca and select the "InstallUISequence" table in the left list.

b) In the right list locate the row that contains "AI_DOWNGRADE" in the "Action" column and delete this row.

c) Do the same for the "AI_DOWNGRADE" row from the "InstallExecuteSequence" table.

d) Save the MSI database after you have performed the modifications.

e) Repeat steps a-d for the other MSI packages.

In a future version of Advanced Installer there will be more control over the Upgrades.

Hope this helps.

Regards,
Ionut
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”