Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6925219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:45:41+00:00 2026-05-27T10:45:41+00:00

I am just not able to find but sure this should have been asked

  • 0

I am just not able to find but sure this should have been asked before, I am trying to set builds on various branch , which differ in terms of workspace mapping and other arguments that are related to branch location , like solution file, what happens is when we increment the major or minor number I branch the code , what I am planning to achieve is when code is branched I could generate build definition file with specific arguments related to that branch like correct workspace , path to solution file and to version file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:45:41+00:00Added an answer on May 27, 2026 at 10:45 am

    I would suggest creating a custom utility that you use to create a branch that will perform the branch operation in version control and also create a build definition to match. Below is some code to create a build definition using the TFS API.

    Alternatively, you can create a web service that subscribes to the CheckInEvent from the TFS Eventing Service and inspect the details to see if it was a branch operation and create a build definition programmatically from there.

    Below code was shamelessly copied from this great blog post: http://geekswithblogs.net/jakob/archive/2010/04/26/creating-a-build-definition-using-the-tfs-2010-api.aspx

    string teamProject = "TeamProjectName";
    string buildController = "BuildControllerName";
    
    TfsTeamProjectCollection server = new TfsTeamProjectCollection(new Uri("http://<tfs>:<port>/tfs"));
    server.EnsureAuthenticated();
    IBuildServer buildServer = (IBuildServer)server.GetService(typeof(IBuildServer));
    
    var buildDefinition = buildServer.CreateBuildDefinition(teamProject);
    buildDefinition.Name = "TestBuild";
    buildDefinition.Description = "description here...";
    
    buildDefinition.ContinuousIntegrationType = ContinuousIntegrationType.Individual;
    
    
    buildDefinition.Workspace.AddMapping("$/Path/project.sln", "$(SourceDir)", WorkspaceMappingType.Map);
    buildDefinition.Workspace.AddMapping("$/OtherPath/", "", WorkspaceMappingType.Cloak); 
    
    buildDefinition.BuildController = buildServer.GetBuildController(buildController); 
    buildDefinition.DefaultDropLocation = @"\\SERVER\Drop\TestBuild"; 
    
    //Get default template 
    var defaultTemplate = buildServer.QueryProcessTemplates(teamProject).Where(p => p.TemplateType == ProcessTemplateType.Default).First(); 
    buildDefinition.Process = defaultTemplate;
    
    //Set process parameters 
    var process = WorkflowHelpers.DeserializeProcessParameters(buildDefinition.ProcessParameters); 
    
    //Set BuildSettings properties 
    BuildSettings settings = new BuildSettings(); 
    settings.ProjectsToBuild = new StringList("$/pathToProject/project.sln"); 
    settings.PlatformConfigurations = new PlatformConfigurationList(); 
    settings.PlatformConfigurations.Add(new PlatformConfiguration("Any CPU", "Debug"));
    process.Add("BuildSettings", settings);
    
    buildDefinition.ProcessParameters = WorkflowHelpers.SerializeProcessParameters(process); 
    
    buildDefinition.RetentionPolicyList.Clear();
    buildDefinition.AddRetentionPolicy(BuildReason.Triggered, BuildStatus.Succeeded, 10, DeleteOptions.All);
    buildDefinition.AddRetentionPolicy(BuildReason.Triggered, BuildStatus.Failed, 10, DeleteOptions.All);
    buildDefinition.AddRetentionPolicy(BuildReason.Triggered, BuildStatus.Stopped, 1, DeleteOptions.All);
    buildDefinition.AddRetentionPolicy(BuildReason.Triggered, BuildStatus.PartiallySucceeded, 10, DeleteOptions.All);
    
    buildDefinition.Save(); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am sure this must have been answered before but I cannot find a
I've been trying to rack my head over this but it's just not working.
I've seen this with other platforms (especially iPhone/iPad) but have not been able to
I've seen this with other platforms (especially iPhone/iPad) but have not been able to
I know this is easy but i m just not able to debug it.
I'm just not too sure the proper way of doing this. I basically have
I'm sure a lot of people need this, but so far I have not
I have a feeling this is a dumb question I should have been able
I feel like this might be really simple but I'm just not getting it
I have tried using a stemmer but the words it produces are just not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.