Search code examples
installationwixwix3wix3.5

Detemining newer version of executable in Wix


We have a software that has couple of executables inside. One of the executables is Windows service, and it doesn't change that often, usually we release many updates to the main executable, but the service version is same inside installer.

When service is installed first time or upgraded with newer version, we need to run custom action. We managed to solve first install part, but we don't know how to determine that version we're installing now is newer than one that already exists. Sort of if(newver > oldver) run custom action.

Thank you in advance - Jack


Solution

  • You can try using the upgrade rules of your package. More details here: How to implement WiX installer upgrade?

    Rob Mensching (the second answer in the linked thread) shows an example for upgrade rules. You should first familiarize yourself with the Upgrade table and how upgrade rules work. There isn't an easy answer or a quick fix for this in WiX.

    Basically, you should have 2 upgrade rules

    • the first sets a property when an older version is found
    • the second sets another property when a newer version is found

    After that you can use the older versions property to condition your custom action. For example, if the property is named OLDERVERSIONFOUND the custom action condition can be:

    OLDERVERSIONFOUND 
    

    or something like

    OLDERVERSIONFOUND > "1.0.0"