首页 > 解决方案 > 当文件也与通配符文件部分条目匹配时,Inno Setup 在卸载期间未取消注册文件

问题描述

我目前使用以下代码来安装和注册 DLL。

[Files]
Source: "Keys\Sentinel\*"; DestDir: "{app}"; Flags: recursesubdirs 32bit 
Source: "Keys\Sentinel\hasp_com_windows.dll"; DestDir: "{app}"; \
    Flags: regserver 32bit noregerror;

这在安装操作期间效果很好,并且日志文件显示该文件已成功注册。我的问题是,在卸载过程中,该文件没有被注销,并且卸载日志文件除了它已被删除之外没有任何关于该文件的信息,它已经被删除了。什么可能导致文件未被注销?帮助文件说它应该是。

标签: inno-setup

解决方案


我可以确认您所看到的行为。

通常,您永远不应使用该部分中的两个不同条目将同一文件安装到同一目标[Files]。这总是会导致意想不到的行为。就像在这种情况下。

正确的解决方案是从通配符条目中排除 DLL:

[Files]
Source: "Keys\Sentinel*"; DestDir: "{app}"; Excludes: "hasp_com_windows.dll";  \
    Flags: recursesubdirs 32bit
Source: "Keys\Sentinel\hasp_com_windows.dll"; DestDir: "{app}"; \
    Flags: regserver 32bit noregerror

推荐阅读