仅针对特定组件编译Inno Setup安装程序 [英] Compile Inno Setup installer for specific component only
问题描述
我有一个Inno Setup脚本,可以创建一个安装程序(例如FullInstall.exe
).该脚本包含几个组件,这些组件是通过标准方式使用类型选择的,因此它当前具有以下内容:
I have an Inno Setup script that creates an installer (FullInstall.exe
, for example). The script contains several components, selected using types in the standard way, so that it currently has something like:
[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
)
What I've been asked to do is to create an installer for the display utility only. I could create a batch file (DispInstall.bat
) which just contained:
FullInstall /COMPONENTS="core,display"
但是,此方法需要与DispInstall.bat
在同一目录中的FullInstall.exe
副本,这并不理想.是否有一种创建DispInstall.exe
文件的方法,该文件的行为类似于FullInstall.exe
而选择了disponly
类型,并且用户无法更改类型或组件选择?
However, this method requires a copy of FullInstall.exe
in the same directory as DispInstall.bat
, which isn't ideal. Is there a method of creating a DispInstall.exe
file which behaves like FullInstall.exe
with the disponly
type selected, and without the user being able to change the type or component selection?
推荐答案
您可以使用 Inno Setup预处理器仅将.iss
脚本过滤为所需的子集:
You can use Inno Setup preprocessor to filter the .iss
script to a desired subset only:
[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
并以相同的方式过滤其他所有涉及过滤后的类型和组件的东西.
And filter everything else that refers to the filtered types and components, the same way.
然后使用 /Ddisponly
命令行开关来编译子集版本.
And then run Inno Setup compiler with /Ddisponly
command-line switch to compile the subset version.
或者,如果您使用Inno Setup GUI进行编译,则可以像这样创建disponly.iss
:
Or if you use Inno Setup GUI for the compilation, you can create disponly.iss
like:
#define disponly
#include "FullInstall.iss"
这篇关于仅针对特定组件编译Inno Setup安装程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!