Share via


Start 命令 (Team Foundation Build)

使用 start 命令可以執行已設定的 Team Foundation Build 組建定義。

必要的使用權限

若要使用 start 命令,您必須將 Visual Studio Team Foundation Server 中的 [佇列組建] 和 [檢視組建定義] 安全性權限設定為 [允許]。 此外,應用程式層服務帳戶和 Team Foundation Build 服務帳戶對於組建放置位置必須有讀取/寫入權限。如需詳細資訊,請參閱 Team Foundation Server 使用權限

TFSBuild start /collection:teamProjectCollectionUrl 
/builddefinition:definitionSpec [/droplocation:droplocation] [/getoption:getoption] 
[/customgetversion:versionSpec] [/priority:priority] [/requestedfor:userName] 
[/msbuildarguments:args] [/shelveset:shelvesetName [/checkin]] 
[/silent] [/queue]

TFSBuild start teamProjectCollectionUrl teamProject definitionName 
[/droplocation:droplocation] [/getoption:getoption] [priority:priority]
 [/customgetversion:versionSpec] [/requestedfor:userName]
[/shelveset:shelvesetName [/checkin]]
[/msbuildarguments:args] [/silent] [/queue]

參數

引數

描述

teamProjectCollectionUrl

包含建置中解決方案和專案之 Team 專案集合的 URL。

teamProject

包含所建置解決方案和專案之 Team 專案的名稱。

definitionName

Team 專案中要用於組建的組建定義名稱。

droplocation

公用資料夾的路徑,在組建完成後,組建的二進位檔和記錄檔便會儲存在其中。 例如,\\server\share。 這會搭配 /droplocation 選項使用。

getoption

搭配 /getoption 選項使用。 有效的值包括 LatestOnQueue、LatestOnBuild 和 Custom。

versionSpec

  • 指定您將 /getoption 設定為 Custom 時想要建構的檔案的 Versionspec。 您可以搭配使用這個命令與 /customgetversion 選項。 如需版本規格語法的詳細資訊,請參閱 命令列語法 (版本控制)

priority

用於組建定義的佇列優先順序。 您可以搭配使用這個引數與 /priority 選項。

有效的值包括 Low、BelowNormal、Normal、AboveNormal 和 High。

userName

您要使其與完整的組建相關聯之使用者的名稱。

args

傳遞至 MSBuild 的命令列引數。

shelvesetName

指定擱置集的名稱,如果您想要開始私用組建,或是開始以閘道簽入觸發程序定義的組建。

選項

描述

/collection

指定 Team 專案集合。

/droplocation

選擇項。 指定組建流程發生的目錄。 這個目錄可縮寫成 /d。 根據預設,會使用組建定義中指定的組建目錄。

注意事項注意事項
   當您選取組建目錄時,務必確定建置空間足夠,因為空間不足將導致取消組建。

/getoption

選擇項。 指定您想要從版本控制取得的檔案。

/customgetversion

選擇項。 指定您想要取得之檔案的自訂版本,如果您將 /getoption 的值指定為 Custom。

/priority

選擇項。 指定組建佇列優先順序。

/requestedfor

選擇項。 指定要求組建的對象。

/msbuildarguments

選擇項。 指定傳遞至 MSBuild 的命令列引數。

一般格式為:

/msbuildarguments:"/p:SomeProperty=SomeValue /t:MySpecialTarget"

/shelveset

選擇項。 指定擱置集的名稱,如果您想要開始私用組建,或是開始以閘道簽入觸發程序定義的組建。

/checkin

選擇項。 您必須啟動已定義閘道簽入觸發的組建,才能使用此選項。 如果您想要系統在組建成功時簽入檔案,請指定這個選項。

/silent

選擇項。 當您指定這個選項時,就不會在組建執行時將輸出寫入 [命令提示字元] 視窗。

/queue

將組建的啟動要求插入組建佇列中,並且立即傳回。

備註

您可以使用 Team Foundation 命令列的 TFSBuild start 命令搭配工作排程器服務,執行週期性或每晚的組建。

如果您要建置一個以上的方案,請在決定建置順序時,考慮讓方案彼此具有相依性。 例如,當 Solution2 相依於 Solution1 時,要先建置 Solution1,然後再建置 Solution2。

根據預設,置放目錄不會自動建立為共用資料夾。 因此,無法將它用於發行組建和測試結果。 您必須手動建立共用資料夾,然後將寫入權限加入至 Windows 目錄,並針對用來執行 Team Build 服務以置放組建的帳戶,以及發行測試結果的測試人員帳戶加入共用權限。

範例

下列範例會建置 Nightlies 組建類型,這個類型是在位於 http://myserver:8080/DefaultCollection 之 Team 專案集合內的 AdventureWorks Team 專案中。 產生的組建位於 BuildDrop 目錄中。

>TFSBuild start http://myserver:8080/DefaultCollection /builddefinition:"AdventureWorks\Nightlies" /droplocation:"\\computername\buildDrops"

下列範例會建置 Nightlies 組建類型,這個類型是在位於 http://myserver:8080/DefaultCollection 之集合內的 AdventureWorks Team 專案中。 產生的組建位於 BuildDrop 目錄中。 使用 /msbuildarguments 選項傳遞診斷的 MSBuild 詳細等級。 如需詳細資訊,請參閱 MSBuild 命令列參考

>TFSBuild start http://myserver:8080/DefaultCollection /builddefinition:"AdventureWorks\Nightlies" /droplocation:"\\computername\buildDrops" /msbuildarguments:"/flp:verbosity=diag"

請參閱

工作

建立基本組建定義

其他資源

Team Foundation Build 命令

執行和監視組建

定義您的建置流程