Inno Setup - 保留单个现有文件,但将所有其他文件安装在目录树中

Inno Setup - Preserve a single existing file, but install all other in a directory tree

我有一个处于 Beta 测试阶段的应用程序。它有应用程序文件和一个数据库 (.db) 文件,我想保留而不是替换它。

假设我向客户提供了 1.0 版,他们安装了它。现在我的 1.1 版在应用程序文件中有一些更改,但在数据库中没有。

如何指示 Inno Setup 保留该文件,而对其余文件进行替换?

[Files]
Source: "D:\nw\testfile.db"; DestDir: "{app}"; Flags: uninsneveruninstall   onlyifdoesntexist
Source: "D:\nw\*"; Excludes: "\node_modules\"; DestDir: "{app}"; Flags:  recursesubdirs createallsubdirs;

使用这个脚本文件,testfile.db 总是被新版本覆盖。

我的目标是在新安装期间保留 testfile.db

2016-06-06 13:36:21.630 -- File entry --
2016-06-06 13:36:21.630 Dest filename: C:\Complexity tool\testfile.txt
2016-06-06 13:36:21.631 Time stamp of our file: 2016-06-06 09:41:08.000
2016-06-06 13:36:21.631 Dest file exists.
2016-06-06 13:36:21.631 Time stamp of existing file: 2016-06-06 09:41:08.000
2016-06-06 13:36:21.631 Version of our file: (none)
2016-06-06 13:36:21.631 Version of existing file: (none)
2016-06-06 13:36:21.631 Installing the file.
2016-06-06 13:36:21.632 Successfully installed the file.

谢谢

问题是虽然文件可能不是由第一个条目 D:\nw\testfile.db 安装的,但它是由第二个通配符条目 D:\nw\*.

安装的

您甚至必须将 onlyifdoesntexist 添加到通配符条目中。或者,如果您需要覆盖所有其他文件,即使它们存在,请从通配符条目中明确排除 testfile.db 文件:

Source: "D:\nw\testfile.db"; DestDir: "{app}"; Flags: uninsneveruninstall onlyifdoesntexist
Source: "D:\nw\*"; Excludes: "\node_modules\,\testfile.db"; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs