0

I want to create gated.checkins programmatically.I have a custom build template.I can create build successfully but when I want to open created build definition from visual studio that time In Process tab selected template comes empty but if I go and selected my custom template that time I can see all my property's and configurations .

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
Juri Noga
  • 4,363
  • 7
  • 38
  • 51
Bilgehan
  • 1,135
  • 1
  • 14
  • 41
  • 1
    What is your question? – Bruno Bieri Aug 10 '17 at 11:59
  • my question is when I want to open build definitation in tfs which I have created programmatically,the build process template is shown not selected – Bilgehan Aug 10 '17 at 12:18
  • Ok, I understand your sentence but I don't understand what your question is. What do you expect to happen which does not happen at the moment? – Bruno Bieri Aug 10 '17 at 12:51
  • Is there any property set may be I missed my code to see process template selected in visual studio like newBuildDefinition.ProcessTemplateName="MyTemplate.xaml"something like that . – Bilgehan Aug 10 '17 at 12:59
  • Possible duplicate of [Create Build Definition from Template with TFS 2015 .NET Client Libraries](https://stackoverflow.com/questions/39134708/create-build-definition-from-template-with-tfs-2015-net-client-libraries) – Bruno Bieri Aug 10 '17 at 13:09
  • Cannot reproduce this issue at my side. Did you create your process template with the xaml file first and then use it in the code? Have you check if the "GatedTemplate" has correct value. – Eddie Chen - MSFT Aug 14 '17 at 07:31
  • What's the result if you manually create a build definition in Visual Studio and select your custom GatedTemplate? This will narrow down if the issue is related to your custom build template. – PatrickLu-MSFT Aug 15 '17 at 01:39

0 Answers0