我有一个创建安装程序的Inno安装脚本(例如FullInstall.exe
)。该脚本包含几个组件,使用标准方式的类型进行选择,因此它当前具有类似的内容:
[Types]
Name: standard; Description: Standard installation
Name: dev; Description: Development installation
Name: disponly; Description: Display utility only
Name: custom; Description: Custom installation; Flags: iscustom
[Components]
Name: core; Description: Core files; Types: standard dev display custom; Flags: fixed
Name: exec; Description: Executive; Types: standard dev custom
Name: exec\debug; Description: Debugger; Types: dev custom
Name: display; Description: Display utility; Types: dev disponly custom
我被要求做的是仅为显示实用程序创建安装程序。我可以创建一个批处理文件(DispInstall.bat
),它只包含:
FullInstall /COMPONENTS="core,display"
但是,此方法需要FullInstall.exe
与DispInstall.bat
在同一目录中的副本,这并不理想。是否有一种创建DispInstall.exe
文件的方法,其行为类似于FullInstall.exe
,并且选择了disponly
类型,并且用户无法更改类型或组件选择?
答案 0 :(得分:1)
您可以使用Inno Setup preprocessor将.iss
脚本过滤为所需的子集:
[Types]
#ifndef disponly
Name: standard; Description: Standard installation
Name: dev; Description: Development installation
#endif
Name: disponly; Description: Display utility only
#ifndef disponly
Name: custom; Description: Custom installation; Flags: iscustom
#endif
[Components]
#ifndef disponly
Name: core; Description: Core files; Types: standard dev display custom; Flags: fixed
Name: exec; Description: Executive; Types: standard dev custom
Name: exec\debug; Description: Debugger; Types: dev custom
#endif
Name: display; Description: Display utility; Types: dev disponly custom
以相同的方式过滤引用过滤类型和组件的所有其他内容。
然后使用/Ddisponly
command-line switch运行Inno Setup编译器来编译子集版本。
或者,如果您使用Inno Setup GUI进行编译,您可以创建disponly.iss
,如:
#define disponly
#include "FullInstall.iss"