我正在编写一个脚本,要求用户选择要安装的应用程序的哪些部分:
仅限应用程序,仅限DataBase Engine,仅限数据或这些的任意组合.
我知道我应该使用[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