TFS Api从自定义流程模板创建构建

时间:2017-08-10 11:56:52

标签: tfs tfsbuild

我想以编程方式创建gated.checkins。我有一个自定义构建模板。我可以成功创建构建但是当我想从visual studio打开创建的构建定义时,在Process选项模板中选择模板是空的但是如果我去选择我的自定义模板,那时我可以看到我的所有属性和配置。

var newBuildDefinition =
buildServer.CreateBuildDefinition(TeamProject);
newBuildDefinition.Name = GatedName;
newBuildDefinition.Description = TFSConstantEnums.AutomaticGatedCreationDescription;
newBuildDefinition.ContinuousIntegrationType = ContinuousIntegrationType.All;
newBuildDefinition.QueueStatus = DefinitionQueueStatus.Enabled;
newBuildDefinition.TriggerType = triggerType;
// ..........................
newBuildDefinition.BuildController = Controllers(buildServer).FirstOrDefault();

var GatedTemplate = buildServer.QueryProcessTemplates(ConstantEnums.BuildProcessTemplateTeamProject).Where(p
=> p.ServerPath.Contains(ProcessTemplateName)).First();
newBuildDefinition.Process = GatedTemplate; //In here my custom template come and I can set it

0 个答案:

没有答案