我正在编写一个脚本,要求用户选择要安装的应用程序的哪些部分:
仅限应用程序,仅限DataBase Engine,仅限数据或这些的任意组合。
我知道我应该使用[Components]
部分来定义这些内容,但我对类型,组件和任务之间的相互作用感到困惑 - 我认为[Tasks]
用于“额外”安装,但后来我看到了明确链接三个的代码。
有人能指出我对这些如何协同工作的一个很好的解释吗? - 我相信有一个......
由于
答案 0 :(得分:13)
组件由一个或多个类型组成。在脚本中,您将使用组件作为选择器,具体取决于最终用户选择的 Type 。 组件可以在任务中使用,因为根据用户选择的类型,任务是否具有任务被执行。
例如:
; 'Types': What get displayed during the setup
[Types]
Name: "full"; Description: "Full installation";
Name: "app"; Description: "Fapplication only";
Name: "dbengine"; Description: "Database engine only";
Name: "data"; Description: "Data only";
; Components are used inside the script and can be composed of a set of 'Types'
[Components]
Name: "full"; Description: "Full installation"; Types: full app dbengine app
Name: "app"; Description: "Fapplication only"; Types: app
Name: "dbengine"; Description: "Database engine only";Types: dbengine
Name: "data"; Description: "Data only"; Types: data
; Defines which files are setup, based on the differents components
[Files]
Source: "MyApp.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: full app
Source: "ADll.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: full app
Source: "Engine.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: full dbengine
Source: "data_0"; DestDir: "{app}"; Flags: ignoreversion; Components: full data
Source: "data_1"; DestDir: "{app}"; Flags: ignoreversion; Components: full data
; In the same fashion, a task can be set for a specific component
[Tasks]
Name: desktopicon; Description: "Create a &desktop icon"; GroupDescription: "Additional icons:"; Components: full app
答案 1 :(得分:1)
我的理解是,一个组件基本上是一组文件 - 它构成了一个主要的组件'什么可以安装。 A'类型'安装是一组安装有意义的组件。这就是我编写@ az01&#39的例子。
; Lists types of installations - the user is presented
; with a list containing these Descriptions:
[Types]
Name: "full"; Description: "Full installation";
Name: "app-only"; Description: "Application only";
Name: "engine-only"; Description: "Database engine only";
Name: "data-only"; Description: "Data only";
; This lists the installable components of the product and
; specifies which type of install they are included in
[Components]
Name: "app"; Description: "Application"; Types: full app-only
Name: "engine"; Description: "Database engine"; Types: full engine-only
Name: "data"; Description: "Data"; Types: full data-only
; each file is assigned to one component, unless it is shared between
; components, in which case maybe it should go in a 'shared' component.
[Files]
Source: "MyApp.exe"; DestDir: "{app}"; Flags:; Components: app
Source: "ADll.dll"; DestDir: "{app}"; Flags:; Components: app
Source: "Engine.dll"; DestDir: "{app}"; Flags:; Components: engine
Source: "data_0"; DestDir: "{app}"; Flags: ignoreversion; Components: data
Source: "data_1"; DestDir: "{app}"; Flags: ignoreversion; Components: data
答案 2 :(得分:0)
可以在Innosetup帮助页面上找到完整的说明: Components and Tasks Parameters
下面我给你一个通用的样本:
[Components]
Name: a; Description: a
Name: b; Description: b
[Tasks]
Name: p; Description: a or b; Components: a or b
Name: q; Description: a and b; Components: a and b
Name: r; Description: not a or b; Components: not a or b
Name: s; Description: not (a or b); Components: not (a or b)
Name: t; Description: a or b - old style; Components: a b