When a previous version of our software is installed, the installer first runs the complete uninstall procedure before installing a new version, to make sure all previous files are properly cleaned up. However, when the user had pinned a shortcut to our application to the taskbar, it is always automatically removed during the uninstall process. This is, at least in our case, not ideal behaviour since the user wants to keep the pinned shortcut (he simply upgraded the software and wants to continue using it).
The recommended solution is to not perform an uninstall before installing; instead, keep track of which files should no longer exist after upgrade and add explicit [InstallDelete] entries (don't use broad wildcards and especially don't try to delete {app}\*). A lot of the time, redundant files can just be left behind without harm (when the app won't get confused by stray files or registrations); most files are small and if it does annoy the user they can do the uninstall themselves.
IMO, this recommendation has its place but can be impractical depending on the complexity of the installer. (Gavin: I am aware you probably disagree with this assessment; we''ll just amicably agree to disagree.)
As I see it, the root problem is the difference between "I am uninstalling and do not intend to reinstall" vs. "this uninstall is happening as a part of an upgrade." I could envision passing a "uninstalling as a part of an upgrade" command-line parameter to the uninstall process that skips certain actions. I don't recall whether the uninstaller supports custom command-line parameters or not.
Yes, you can still use {param:X} constants or ParamCount/ParamStr from InitializeUninstall or other uninstall event functions.
IMO, this recommendation has its place but can be impractical depending on the complexity of the installer. (Gavin: I am aware you probably disagree with this assessment; we''ll just amicably agree to disagree.)
Or, does someone see an alternative way around this issue?
When a previous version of our software is installed, the installer first runs the complete uninstall procedure before installing a new version, to make sure all previous files are properly cleaned up
Why aren't you using [InstallDelete] to clean things up?
Bill, I wonder what kind of complexity you mean and whether it could be addressed. Could you shed some light on this?
I would think [InstallDelete] is mostly good enough to handle files which no longer exist. There are some limitations that we could fix, like being able to 'unregisterserver'. Or are you thinking about other things? It must be things the uninstaller can do, but [InstallDelete] or [Code] cannot?
One possible reason is that [InstallDelete] only deletes files. It doesn't undo other installer changes such as registry entries, services installed, etc. (Depending on the use case, an upgrade may need to remove things other than files.)