Hello,
Case 1.
Current version (1.0) Upgrades/Order: "Uninstall old version first and then install new version".
Next version (2.0) has the same Upgrades/Order: "Uninstall old version first and then install new version".
If the current version is already installed and a user run the next version installer. What would be custom actions sequence?
I guess it would be:
current version (1.0) uninstall custom actions and then at some point next version (2.0) install custom actions. Right?
Indeed, this is correct. In this case, the installer removes the old applications entirely before installing the new applications. That means the uninstall custom actions of the old version will be executed before installing the new version.
The Upgrade process is: Uninstall old version first and then install new version. Your custom actions will be executed like this:
1. First, from the new version (2.0) all of the custom actions scheduled before "RemoveExistingProducts" will be executed (if their condition is met).
2. Version 1.0 is uninstalled and also the custom actions scheduled on uninstall will be executed from the old version.
3. The installation continues with the new version.
Case 2.
Current version Upgrades/Order: "Uninstall old version first and then install new version".
Next version has different Upgrades/Order: "Install new version first and then uninstall old version".
If the current version is already installed and a user run the next version installer. What would be custom actions sequence?
I guess it would be:
The next version (2.0) install custom actions and then at some point current version (1.0) uninstall? Or next version (2.0) unistall custom actions?
In this case, the installer updates files before removing the old applications. Only the files being updated get installed during the installation. If the old application's removal fails, then the installer rolls back both the old application's removal and the new application's install.
Please note that some rules must be respected when using this option (as it is not how the Windows Installer would normally operate). More details on the
Upgrades article.
Changing the upgrade order to install new version first and then uninstall old version is able to preserve old version in case the upgrade fails. The first version will be installed, and then the old version will be uninstalled (thus its uninstall custom action will be executed). The upgrade process performs the following actions:
- Start installation of the new product
- Check for matching components between products. Install the new components from new product.
- Uninstall the components that are not used by the new product.
Basically, what is written in the orange box from the above article means:
- the new version of your installer will run
- it will check the version of your files and only install the newer files. For instance, if in the first version (the one already installed) you have version 1.0 of an EXE/DLL and in the newer version (the one you are about to install), you have version 2.0 of the same EXE/DLL, then the 1.0 version will be replaced by the 2.0 version.
After all the files are replaced, then the files from the older version are removed. For instance, if in version 1.0 you have a TXT file that no longer exists in version 2.0, it will be removed.
Also, here, we must pay attention to the
file versioning rules.
For instance, if you want a non versioned file to be upgraded (e.g. a TXT file, a config file - INI, XML), then you will need to set the "Always overwrite" flag for it.
You can check the
Windows Installer Upgrades
article for more details.
Hope this helps!
Best regards,
Liviu