What happens when you setup an Inno Setup .iss file to install the same file to the same location twice? Does Inno Setup realize what you are doing, and just include and install the file once, or does it collect the file into the install multiple times, and overwrite it for each instance?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Inno Setup is smart enough to identify an identical source file and will include it only once to the installer. There's a legitimate reason for having duplicate source files; you may want to install the same file to different locations on the target system.
What Inno Setup won't identify is an identical target location (I cannot think of a legitimate reason for having identical target location). So it will install the file twice. Obviously as it installs it twice to an identical location, the second installation actually does not happen (with executable files with the default flags, as the version match) or is barely noticeable (as you overwrite an identical data file).
[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.
标签:
inno-setup