关于在 Inno Setup 脚本的 [UninstallRun] 部分中使用 RunOnceId 的说明
Clarification about using RunOnceId in [UninstallRun] section of Inno Setup script
这是我的 [UninstallRun]
部分:
[UninstallRun]
Filename: {dotnet40}\regasm.exe; Parameters: /u MSAToolsLibrary_x86.dll; WorkingDir: {app}; Flags: runhidden;
Filename: {dotnet4064}\regasm.exe; Parameters: /u MSAToolsLibrary_x64.dll; WorkingDir: {app}; Flags: runhidden; Check: IsWin64;
Filename: {dotnet40}\regasm.exe; Parameters: /u MSAToolsGMailLibrary_86.dll; WorkingDir: {app}\MSAToolsGMailLibrary; Flags: runhidden
Filename: {dotnet4064}\regasm.exe; Parameters: /u MSAToolsGMailLibrary_64.dll; WorkingDir: {app}\MSAToolsGMailLibrary; Flags: runhidden; Check: IsWin64;
当我使用 Inno Setup 6.1.1 编译时,我收到此警告:
Warning: There are [UninstallRun]
section entries without a RunOnceId
parameter. By assigning a string to RunOnceId
, you can ensure that a particular [UninstallRun]
entry will only be executed once during uninstallation. See the "[UninstallRun]
" topic in help file for more information.
我已经查找了 RunOnceId
的帮助,其中指出:
Valid only in an [UninstallRun]
section. If the same application is installed more than once, "run" entries will be duplicated in the uninstall log file. By assigning a string to RunOnceId
, you can ensure that a particular [UninstallRun]
entry will only be executed once during uninstallation. For example, if two or more "run" entries in the uninstall log have a RunOnceId
setting of "DelService", only the latest entry with a RunOnceId
setting of "DelService" will be executed; the rest will be ignored. Note that RunOnceId
comparisons are case-sensitive. If you don't assign a string to RunOnceId
, the compiler will warn you about this, which can be disabled using MissingRunOnceIdsWarning
.
我可以看到我可以关闭警告。但是我想知道我是否真的需要在我的设置中使用这个参数,因为直到现在我才这样做过。
您应该按照警告建议使用该参数。
如果您不这样做,对于每次升级(除非您的安装程序卸载以前的版本),都会排队执行新的 [UninstallRun]
命令。所以如果你安装然后升级9次,你所有的卸载命令都会执行10次,卸载的时候。当然,在您的情况下,这仅意味着每个 regasm /u
命令都会失败 9 次。没什么大不了的,但是如果用户检查卸载程序日志(如果他们有问题),他们会看到很多失败,这可能会误导他们。
请注意,您无法追溯修复此问题。先前安装程序排队的卸载命令仍将针对每个过去的安装执行。但同样,如果这是一个主要问题,您可能已经注意到了。
这是我的 [UninstallRun]
部分:
[UninstallRun]
Filename: {dotnet40}\regasm.exe; Parameters: /u MSAToolsLibrary_x86.dll; WorkingDir: {app}; Flags: runhidden;
Filename: {dotnet4064}\regasm.exe; Parameters: /u MSAToolsLibrary_x64.dll; WorkingDir: {app}; Flags: runhidden; Check: IsWin64;
Filename: {dotnet40}\regasm.exe; Parameters: /u MSAToolsGMailLibrary_86.dll; WorkingDir: {app}\MSAToolsGMailLibrary; Flags: runhidden
Filename: {dotnet4064}\regasm.exe; Parameters: /u MSAToolsGMailLibrary_64.dll; WorkingDir: {app}\MSAToolsGMailLibrary; Flags: runhidden; Check: IsWin64;
当我使用 Inno Setup 6.1.1 编译时,我收到此警告:
Warning: There are
[UninstallRun]
section entries without aRunOnceId
parameter. By assigning a string toRunOnceId
, you can ensure that a particular[UninstallRun]
entry will only be executed once during uninstallation. See the "[UninstallRun]
" topic in help file for more information.
我已经查找了 RunOnceId
的帮助,其中指出:
Valid only in an
[UninstallRun]
section. If the same application is installed more than once, "run" entries will be duplicated in the uninstall log file. By assigning a string toRunOnceId
, you can ensure that a particular[UninstallRun]
entry will only be executed once during uninstallation. For example, if two or more "run" entries in the uninstall log have aRunOnceId
setting of "DelService", only the latest entry with aRunOnceId
setting of "DelService" will be executed; the rest will be ignored. Note thatRunOnceId
comparisons are case-sensitive. If you don't assign a string toRunOnceId
, the compiler will warn you about this, which can be disabled usingMissingRunOnceIdsWarning
.
我可以看到我可以关闭警告。但是我想知道我是否真的需要在我的设置中使用这个参数,因为直到现在我才这样做过。
您应该按照警告建议使用该参数。
如果您不这样做,对于每次升级(除非您的安装程序卸载以前的版本),都会排队执行新的 [UninstallRun]
命令。所以如果你安装然后升级9次,你所有的卸载命令都会执行10次,卸载的时候。当然,在您的情况下,这仅意味着每个 regasm /u
命令都会失败 9 次。没什么大不了的,但是如果用户检查卸载程序日志(如果他们有问题),他们会看到很多失败,这可能会误导他们。
请注意,您无法追溯修复此问题。先前安装程序排队的卸载命令仍将针对每个过去的安装执行。但同样,如果这是一个主要问题,您可能已经注意到了。