mat_bruges
Posts: 33
Joined: Tue Mar 11, 2008 12:28 am

Launch condition to compare version numbers

Hi,

I have a framework that all my other software products rely on. So far I have been able to distribute different versions of both the framework and the products separately, everything keeps working OK since the interfaces remain constant.

But now the 2.0 version of my framework no longer works with the 1.x versions of my products. So I want to create a number of launch conditions in the framework installer, to force the user to uninstall any old 1.x versions of the products.

Here's what I have tried so far:

- I created a search in the registry to get the version number of one of my products, for example 1.0.6. I wanted to create a launch condition to say "check if this version is smaller than 2.0". It looks like this is not possible. I would have to list all of the versions I have ever released, e.g. version = 1.0.0 or version = 1.0.1 or version = 1.0.2 etc... But this is a huge job to type in, some products have dozens of versions.

- I then noticed that file searches seemed to have some way to specify minimum and maximum version number, so I then tried the following: I created a registry search that returns the folder where the main executable for that product is installed. I called this PRODUCT_FOLDER and specified that it returns a folder path. I then created a file search that looks for the main executable, and I specified that folder as the location (from the properties dialog). This does not seem to work, it always returns empty.

- The standard file search does not seem like a valid option to me. I need to search for half a dozen products, and if we have to search all the drives on the machine then this can take half an hour. Searching the program files folder is not very reliable either, since the user may have chosen a completely different install folder.

I there any way to do this? I have so much information available in the registry, it seems silly that I can't use it now from AI. (I have the folder name, main filename, version number, and I still can't check if the product version is less than 2.0??)

If this can't be done, perhaps you could mark this down as a feature request: the < and > operators in the conditions should be able to compare version numbers.

Thanks

Mat
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

If the installation packages for this framework are MSI-based and the installation package of the new version of the framework is created with Advanced Installer, you can use the "Upgrades" page to make sure that the new installer will automatically uninstall the old ones.

You can read more about this page here:
http://www.advancedinstaller.com/user-g ... rades.html

However, if this is not an option for you then the best solution is to create a search for all the versions of the framework which are not supported. In this case you will use the properties of all the searches in the condition of your custom launch condition.
If this can't be done, perhaps you could mark this down as a feature request: the < and > operators in the conditions should be able to compare version numbers.
Please note that this is already supported. For example, in the "Condition" field of a custom launch condition you can use this:

Code: Select all

PROPERTY<"2.0.0"
Another approach you could take is to search for the key member of a component which is present in all the installation packages of the framework. In this case the key member must have a version and you should be able to determine the framework version based on it (for example you cannot use a file which always has the same version).

For this approach you can create a File search which has the location set to a component. In the properties page of the file search you can set the minimum and maximum versions which can be found. If the search is successful then it found the file (and an older installation).
I created a registry search that returns the folder where the main executable for that product is installed. I called this PRODUCT_FOLDER and specified that it returns a folder path. I then created a file search that looks for the main executable, and I specified that folder as the location (from the properties dialog).
Note that Windows Installer does not guarantee the order of the searches, therefore you shouldn't use a search which is based on the result of another search.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mat_bruges
Posts: 33
Joined: Tue Mar 11, 2008 12:28 am

Thanks Cosmin! Those Upgrades are great, that's exactly what I need. I had not looked at that because I thought this was only for upgrading the product that was currently being installed.

The version comparison now works as well by the way (I had not included the double quotes).

Return to “Feature Requests”