2012-01-17 61 views
6

我寫一個腳本,需要用戶選擇的應用程序的部分安裝的:只有唯一Inno Setup的 - 正確使用[類型],[成分]和[任務]

應用程序,數據庫引擎,數據只有或這些的任何組合。

我知道我應該使用[Components]部分來定義這些,但我對類型,組件和任務之間的相互作用感到困惑 - 我認爲[Tasks]是用於「額外」安裝,但後來我看到代碼明確地將三者聯繫起來。

任何人都可以指出我對這些如何一起工作的一個很好的解釋嗎? - 我相信有一個...

感謝

回答

12

組件是由一個或多個類型。在腳本中,您將使用組件作爲選擇器,具體取決於最終用戶選擇的類型組件可以在任務中使用,因爲這取決於類型由用戶任務將具有或不具有選擇將被執行。

例如:

; '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 
+0

如果某些文件僅在選擇某個任務時才安裝,該怎麼辦?他們是否仍然需要指定的組件? – Nyerguds 2013-03-18 09:31:30

1

我的理解是,一個組件是一個基本的一組文件 - 它構成了可以安裝什麼重大的「組件」。安裝的「類型」是一組安裝在一起的有意義的組件。這就是我編碼@ 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