Not so Permanent
Posted 25 June 2007 - 10:17
My problem is sort-of vendor specific, but there isn't a section for Advanced Installer so I thought I'd post it here.
I have an application that uses semi-permanent files. By this I mean the file(s) should be persisted through upgrades, but must be removed when uninstalling. Getting this to work is giving me a headache.
* "Never Overwrite" flag - the file disappears after upgrade (I know this is due to InstallExecuteSequence. Where should RemoveExistingProducts be ideally?)
* Putting the files in a seperate feature that isn't removed during an upgrade.
This persists the file during upgrades but they don't get uninstalled.
... I'm still trying other options but I'm really frustrated and hoping for some guidance.
Posted 25 June 2007 - 10:49
Posted 25 June 2007 - 11:01
Is there any other way to do this? Advanced Installer doesn't allow you to change the sequences, so I'll have to change the MSI after each build...
Posted 25 June 2007 - 12:30
The RemoveExistingProducts action must be scheduled in the action sequence in one of the following locations.
- Between the InstallValidate action and the InstallInitialize action. In this case, the installer removes the old applications entirely before installing the new applications. This is an inefficient placement for the action because all reused files have to be recopied.
- After the InstallInitialize action and before any actions that generate execution script.
- Between the InstallExecute action, or the InstallExecuteAgain action, and the InstallFinalize action. Generally the last three actions are scheduled right after one another: InstallExecute, RemoveExistingProducts, and InstallFinalize. In this case the updated files are installed first and then the old files are removed. However, if the removal of the old application fails, then the installer rolls back both the removal of the old application and the install of the new application.
- After the InstallFinalize action. This is the most efficient placement for the action. In this case, the installer updates files before removing the old applications. Only the files being updated get installed during the installation. If the removal of the old application fails, then the installer only rolls back the uninstallation of the old application.
All major MSI tools will have a way to control what option from the list above is used for major upgrades. Look in any "upgrade view" or similar. What you need is either one of the latter two options. This will ensure that shared files between versions don't get uninstalled.
On another note: minor upgrades are not uninstalls and reinstalls and as such might work better for you. Minor upgrades are much more fuzzy about what you are allowed to do however. Check the SDK for the list of restrictions (or Stefan's www.msifaq.com site).
Finally: If I were you I would install these files permanent and then write myself a custom action to do the cleanup on uninstall and condition it with (Not UPGRADINGPRODUCTCODE AND REMOVE~="ALL"). This will ensure that the action is only run during real uninstalls and not during major upgrade uninstalls (UPGRADINGPRODUCTCODE is set during major upgrades).
Posted 27 June 2007 - 14:59
Posted 27 June 2007 - 15:11
Futhermore, the default Advanced Installer behaviour towards "Automatically uninstall previous versions" doesn't allow you to choose the entries in the "remove" column in the upgrade table anyway...
Posted 28 June 2007 - 08:23
Thank you for bringing this to our attention.
We have added this improvement on our TODO list and we are targeting our next release (5.1) to make it available.
Edited by Ciprian, 28 June 2007 - 08:26.
Advanced Installer Team