Inno setup Inno设置-正确使用[类型]、[组件]和[任务]
我正在编写一个脚本,要求用户选择安装应用程序的哪些部分: 仅限应用程序、仅限数据库引擎、仅限数据或以上任意组合 我知道我应该使用Inno setup Inno设置-正确使用[类型]、[组件]和[任务],inno-setup,Inno Setup,我正在编写一个脚本,要求用户选择安装应用程序的哪些部分: 仅限应用程序、仅限数据库引擎、仅限数据或以上任意组合 我知道我应该使用[Components]部分来定义它们,但我对类型、组件和任务之间的相互作用感到困惑——首先,我认为[Tasks]是用于“额外”安装的,但后来我看到了明确链接这三者的代码 有谁能给我一个很好的解释,说明它们是如何协同工作的我肯定有一个 谢谢组件由一种或多种类型组成。在脚本中,您将根据最终用户选择的类型使用组件作为选择器。可以在任务中使用组件,因为根据用户选择的类型,任务
[Components]
部分来定义它们,但我对类型、组件和任务之间的相互作用感到困惑——首先,我认为[Tasks]
是用于“额外”安装的,但后来我看到了明确链接这三者的代码
有谁能给我一个很好的解释,说明它们是如何协同工作的我肯定有一个
谢谢组件由一种或多种类型组成。在脚本中,您将根据最终用户选择的类型使用组件作为选择器。可以在任务中使用组件,因为根据用户选择的类型,任务将执行或不执行
例如:
; '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
我的理解是,组件基本上是一组文件——它构成了可以安装的主要“组件”。“类型”安装是一种组件选择,可以一起安装。下面是我编写@az01示例的方法
; 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
有关完整的说明,请参见Innosetup帮助页面: 及 我给你以下一个通用示例:
[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
如果仅在选择某个任务时才安装某些文件,该怎么办?他们还需要指定的组件吗?