1

I've configured Inno Setup to uninstall the previous app version when running an installer. However, this means that all icons are deleted. Naturally, users complain that they pin my program to taskbar but the icons disappear after program update. Is there a way to either make the installer pin the icon, or tell preserve the main (desktop or Start menu) icon when uninstalling the old version before update?

The uninstallation is invoked with the following code, so there's not much room for customization there:

Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode)
Violet Giraffe
  • 32,368
  • 48
  • 194
  • 335
  • 1
    There is normally no need to uninstall the old version before installing the new one which is why there is no native support for doing it. Your `UnInstallOldVersion()` must be coming from a 3rd party `#include ...` file. I know of no way to tell windows that you'll be putting the file straight back again and not do its usual cleanup. – Deanna Sep 25 '14 at 11:38
  • 1
    @Deanna: you should always uninstall before installing because otherwise if the old version had some file that the new version does not have, this file will become dangling and will never be cleaned up. – Violet Giraffe Sep 25 '14 at 13:01
  • @Deanna: found the code for `UnInstallOldVersion` and added to the question. – Violet Giraffe Sep 25 '14 at 13:03
  • How to pin application to taskbar I've shown e.g. in [`this post`](http://stackoverflow.com/a/25066024/960757). But it's a hacky way as well as will be hacky to determine whether the icon is pinned. – TLama Sep 25 '14 at 13:08
  • 1
    "if the old version had some file that the new version does not have, this file will become dangling and will never be cleaned up." That's what `[InstallDelete]` is for. Uninstall is for complete uninstall, not removing odd files. – Deanna Sep 25 '14 at 13:08
  • @Deanna: Hmm, let me read the docs. I don't have `[InstallDelete]` section atm. – Violet Giraffe Sep 25 '14 at 13:26

1 Answers1

0

Turns out Inno Setup can handle update correctly. All I have to do is remove my code that invokes uninstaller before installing a new version, and then I had to add an attribute:

UsePreviousAppDir=yes

More info on the topic: http://www.jrsoftware.org/iskb.php?updateinstall

Violet Giraffe
  • 32,368
  • 48
  • 194
  • 335
  • No, you don't need to explicitly set the [`UsePreviousAppDir`](http://www.jrsoftware.org/ishelp/index.php?topic=setup_usepreviousappdir) directive value to `yes` because it's already a default value. – TLama Sep 26 '14 at 10:48
  • @VioletGiraffe You really don't need to un-install your application before doing an upgrade. Within your upgrade you either overwrite existing files (like local databases, icon files or whatever), install new versions of your accompanying files (for example some DLLs or so), or you delete them if they are not used anymore and if they annoy you. Not sure which files you really want to un-install, but if you feel like posting them here, please do so. Without any further information I would just say "Overwrite your existing files!" during the upgrade. InnoSetup will do that automatically. – tmighty Feb 03 '15 at 23:20
  • @tmighty: there's no doubt it will overwrite files. I was afraid some files might become dangling, but as it turns out InnoSetup handles everything correctly. – Violet Giraffe Feb 04 '15 at 05:51