How can I safely remove old InnoSetup installations?

随声附和 提交于 2020-01-22 02:13:07

问题


I use InnoSetup 5.5.1 (a) for my Delphi 6 software installations. A user just informed me that the old uninstall entries pile up in the Control Panel Remove Programs list if not uninstalled manually. I'm thinking of changing my install to remove old entries automatically but I don't want to remove old entries that are valid. Some users like to keep an old version or two around in case they don't like a later version or for fear a later version will break something.

For clarity's sake, I am referring specifically to the typical situation where a user usually accepts the default installation directory, overwriting the existing version. However, with the exception that some users may install one or more versions to a different directory just to preserve them, while choosing to overwrite most of the time. I found this SO post on removing old versions:

InnoSetup: How to automatically uninstall previous installed version?

But did not see any mention on knowing how to detect which of the old versions are superfluous or not.

Therefore, during an install, how can I automatically remove old uninstall entries automatically from the installed program list without removing any that the user actually wants to keep?


回答1:


As long as you keep your AppId the same between different versions of your application, there will only ever be one Add/Remove entry for it, no matter how many times the user runs the installer. This is the normal and recommended design for a typical application where the user only has one copy of it and wants to keep it up to date.

If, however, the user chooses alternate installation locations in one or more of the later installs, then it's possible for the older location to get "orphaned" -- running the uninstall will remove the newer copy but leave the older one behind, with no Add/Remove entry. (It will still be possible to uninstall it by running the uninstaller manually.) It's normally recommended to avoid this situation by including these options in your [Setup] section:

DisableDirPage=auto
DisableProgramGroupPage=auto

Using these options will make Inno skip asking these questions for an upgrade install, which helps to prevent the user accidentally making orphan copies. (If the user does intentionally want to move the installation, they can still do it by uninstalling first.)

Note that I've sidestepped your question a bit, since as written it doesn't make sense -- if there are multiple copies, there's no possible way to automatically determine which are "superfluous", since that's purely a judgement call on the part of the user. What I've tried to explain here is that your design should aim to discourage this happening accidentally.



来源:https://stackoverflow.com/questions/14015627/how-can-i-safely-remove-old-innosetup-installations

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!