简体   繁体   English

如何安全地删除旧的 InnoSetup 安装?

[英]How can I safely remove old InnoSetup installations?

I use InnoSetup 5.5.1 (a) for my Delphi 6 software installations.我将 InnoSetup 5.5.1 (a) 用于我的 Delphi 6 软件安装。 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? InnoSetup:如何自动卸载以前安装的版本?

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?因此,在安装过程中,如何自动从已安装的程序列表中自动删除旧的卸载条目而不删除用户实际想要保留的任何条目?

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.只要您在应用程序的不同版本之间保持AppId相同,无论用户运行安装程序多少次,它都只会有一个添加/删除条目。 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: (仍然可以通过手动运行卸载程序来卸载它。)通常建议通过在[Setup]部分中包含以下选项来避免这种情况:

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.使用这些选项将使 Inno 在升级安装时跳过询问这些问题,这有助于防止用户意外制作孤立副本。 (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.我在这里试图解释的是,您的设计应该旨在阻止这种意外发生。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM