当您两次列出同一个文件时,Inno Setup 中会发生什么?

What happens in Inno Setup when you list the same file twice?

当您将 Inno Setup .iss 文件设置为将同一文件安装到同一位置两次时会发生什么情况? Inno Setup 是否意识到您在做什么,只包含并安装文件一次,还是多次将文件收集到安装中,并为每个实例覆盖它?

Inno Setup 足够智能,可以识别相同的源文件,并且只会将其包含在安装程序中一次。拥有重复的源文件是有正当理由的;您可能希望将同一文件安装到目标系统上的不同位置。请注意 Inno Setup .

Inno Setup 无法识别的是相同的目标位置(我想不出具有相同目标位置的正当理由)。所以它会安装文件两次。显然,因为它会将它安装到相同的位置两次,所以第二次安装实际上并没有发生(使用具有默认标志的可执行文件,因为版本匹配)或者几乎不会引起注意(因为您覆盖了相同的 data 文件).

[Files]
Source: "MyProg.exe"; DestDir: "{app}"
Source: "MyProg.exe"; DestDir: "{app}"
Source: "Requirements.txt"; DestDir: "{app}"
Source: "Requirements.txt"; DestDir: "{app}"
2015-04-01 17:33:06.529   -- File entry --
2015-04-01 17:33:06.529   Dest filename: C:\Program Files (x86)\My Program\MyProg.exe
2015-04-01 17:33:06.529   Time stamp of our file: 2013-08-27 02:00:00.000
2015-04-01 17:33:06.529   Installing the file.
2015-04-01 17:33:06.542   Successfully installed the file.
2015-04-01 17:33:06.543   -- File entry --
2015-04-01 17:33:06.543   Dest filename: C:\Program Files (x86)\My Program\MyProg.exe
2015-04-01 17:33:06.543   Time stamp of our file: 2013-08-27 02:00:00.000
2015-04-01 17:33:06.543   Dest file exists.
2015-04-01 17:33:06.543   Time stamp of existing file: 2013-08-27 02:00:00.000
2015-04-01 17:33:06.543   Version of our file: 1.5.0.0
2015-04-01 17:33:06.545   Version of existing file: 1.5.0.0
2015-04-01 17:33:06.545   Same version. Skipping.
2015-04-01 17:33:06.545   -- File entry --
2015-04-01 17:33:06.545   Dest filename: C:\Program Files (x86)\My Program\Requirements.txt
2015-04-01 17:33:06.546   Time stamp of our file: 2015-04-01 17:29:10.000
2015-04-01 17:33:06.546   Installing the file.
2015-04-01 17:33:06.547   Successfully installed the file.
2015-04-01 17:33:06.547   -- File entry --
2015-04-01 17:33:06.547   Dest filename: C:\Program Files (x86)\My Program\Requirements.txt
2015-04-01 17:33:06.548   Time stamp of our file: 2015-04-01 17:29:10.000
2015-04-01 17:33:06.548   Dest file exists.
2015-04-01 17:33:06.548   Time stamp of existing file: 2015-04-01 17:29:10.000
2015-04-01 17:33:06.548   Version of our file: (none)
2015-04-01 17:33:06.549   Version of existing file: (none)
2015-04-01 17:33:06.549   Installing the file.
2015-04-01 17:33:06.550   Successfully installed the file.