【问题标题】:Compile Inno Setup installer for specific component only仅为特定组件编译 Inno Setup 安装程序
【发布时间】:2018-07-08 01:50:12
【问题描述】:

我有一个创建安装程序的 Inno Setup 脚本(例如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"

但是,此方法需要在与DispInstall.bat 相同的目录中复制FullInstall.exe,这并不理想。有没有一种方法可以创建一个 DispInstall.exe 文件,该文件的行为类似于 FullInstall.exe 并选择了 disponly 类型,并且用户无法更改类型或组件选择?

【问题讨论】:

    标签: inno-setup


    【解决方案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"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多