TFS 2013: Customize Git build template error: custom template not found

TFS 2013: Customize Git build template error: custom template not found

我正在使用 TFS 2013 Update 5 和 Git 存储库。我需要自定义默认的 Git 构建模板 (GitTemplate.12.xaml)。

我创建了一个新分支并推送了修改后的构建模板。接下来,我创建了一个新的构建定义来测试自定义模板,指定了 "Source settings" 下的新分支。在 Process 选项卡下选择了新模板,但是当我 运行 构建时,它找不到模板。它抛出以下错误:

TF215097: An error occurred while initializing a build for build definition \MobilePayments\CheckinToDevelop-notes: Exception Message: Git repository for path vstfs:///Git/VersionedItem///feature//BuildTemplate/GitTemplate.12_custom.xaml was not found. (type FileNotFoundException)

为什么在 运行构建时找不到模板的任何线索?

这是一个权限问题。

所以只需确保 build agent service accountthe build controller service account 具有访问分支的正确权限。

请参阅@DevOpsy 在评论中的说明:

The build agent service account did have access to the branch however it was the build controller service account that also needed access to the branch as the controller is the first point where it downloads the template and then searches for an available agent to execute the build.