Inno设置 - 正确使用[类型],[组件]和[任务]

Lit*_*ish 8 inno-setup

我正在编写一个脚本,要求用户选择要安装的应用程序的哪些部分:

仅限应用程序,仅限DataBase Engine,仅限数据或这些的任意组合.

我知道我应该使用该[Components]部分来定义这些,但我对类型,组件和任务之间的相互作用感到困惑 - 首先,我认为[Tasks]是"额外"安装,但后来我看到了明确链接三者的代码.

谁能指点我对这些如何协同工作的一个很好的解释? - 我相信有一个......

谢谢

az0*_*z01 13

组件由一种或多种类型组成.在脚本中,您将使用组件作为选择器,具体取决于最终用户选择的类型.组件可以在任务中使用,因为根据用户选择的类型,任务将被执行或不被执行.

例如:

; '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
Run Code Online (Sandbox Code Playgroud)