AndrewCh
AndrewCh

Reputation: 45

Multiple Inno Setup Types that have optional Components

I am trying to create a Inno Setup installer (with Inno Setup 6.2.0) that has multiple setup Types where more than one can have optional Components (as well as fixed components). For example, suppose I want to have the following setup types:

If the "Instructor" setup type is selected, I would like to have an "Instructor - Fixed" component (which must be installed), plus two optional components "Instructor- Optional 1" and "Instructor - Optional 2".

Similarly for the "Student" setup type, I would like a fixed component plus a couple of optional components.

Below is the starting point for my experiments:

[Types]
Name: TYPE_INSTRUCTOR ; Description: "Instructor" ;
Name: TYPE_STUDENT    ; Description: "Student" ;

[Components]
Name: COMP_INSTRUCTOR            ; Description: "Instructor"              ; Types: TYPE_INSTRUCTOR
Name: COMP_INSTRUCTOR\FIXED      ; Description: "Instructor - Fixed"      ; Types: TYPE_INSTRUCTOR ; Flags: fixed
Name: COMP_INSTRUCTOR\OPTIONAL_1 ; Description: "Instructor - Optional 1" ; Types: TYPE_INSTRUCTOR
Name: COMP_INSTRUCTOR\OPTIONAL_2 ; Description: "Instructor - Optional 2" ; Types: TYPE_INSTRUCTOR

Name: COMP_STUDENT            ; Description: "Student"                    ; Types: TYPE_STUDENT
Name: COMP_STUDENT\FIXED      ; Description: "Student - Fixed"            ; Types: TYPE_STUDENT ; Flags: fixed
Name: COMP_STUDENT\OPTIONAL_1 ; Description: "Student - Optional 1"       ; Types: TYPE_STUDENT
Name: COMP_STUDENT\OPTIONAL_2 ; Description: "Student - Optional 2"       ; Types: TYPE_STUDENT


[Files]
Source: "InstFixed.txt" ; DestDir: {app} ; Components: COMP_INSTRUCTOR\FIXED
Source: "InstOpt1.txt"  ; DestDir: {app} ; Components: COMP_INSTRUCTOR\OPTIONAL_1
Source: "InstOpt2.txt"  ; DestDir: {app} ; Components: COMP_INSTRUCTOR\OPTIONAL_2

Source: "StuFixed.txt" ; DestDir: {app} ; Components: COMP_STUDENT\FIXED
Source: "StuOpt1.txt"  ; DestDir: {app} ; Components: COMP_STUDENT\OPTIONAL_1
Source: "StuOpt2.txt"  ; DestDir: {app} ; Components: COMP_STUDENT\OPTIONAL_2

I have tried a few different things, but nothing has succeeded in achieving what I need. I have tried:

The only way I can think to get around this is to have setup types for every possible combination. That would not be practical (this example is not my real problem, just a simple case to illustrate it, I would end up with a very large list of setup types).

Thank you in advance for any workable solutions.

Upvotes: 1

Views: 686

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202222

That's not possible. At least not without some heavy customization with Pascal Scripting.


Way easier is to drop the Types altogether and use two top-level mutually-exclusive components and couple of optional subcomponents:

[Types]
Name: "custom"; Description: "Custom installation"; Flags: iscustom

[Components]
Name: "intructor"; Description: "Instructor"; Flags: exclusive
Name: "intructor\opt1"; Description: "Optional 1"
Name: "intructor\opt2"; Description: "Optional 2"
Name: "student"; Description: "Student"; Flags: exclusive
Name: "student\opt1"; Description: "Optional 1"
Name: "student\opt2"; Description: "Optional 2"

enter image description here

Upvotes: 3

Related Questions