Quick Response Sample – Visual Studio Extension to support the ALM Rangers Branching and Merging guidance


Quick Response samples provide information directly from Visual Studio ALM Rangers working with the Microsoft Visual Studio Product Group and Microsoft Services, in response to feature gaps to supplement the product and knowledge base information.



It is not simple to implement a consistent branching model, that complies with the VS TFS Branching and Merging Guide. Ultimately you would want support for this inside Visual Studio.


Team Foundation Server has extensive support for version control and branching management through the object model. You can create your own solution, using the sample Visual Studio Extension, in the Quick Response download package. For an overview see the Quick Reference Sheet, which is also included in the sample code package.



To use the sample, proceed as follows:

  • Rebuild the sample code using Visual Studio 2012, whereby you require the TFS 2012 Object Model (OM) and the Visual Studio 2012 SDK.
  • Install the TfsBranchToolVSExtension.vsix file into Visual Studio 2012, by double clicking on it.
  • Start Visual Studio 2012 and navigate to Source Control Explorer
  • Mark a folder and right click on it.
  • You will now have a new menu, right above the ordinary Branch and Merge menu
  • Expand it and you will find an option to Apply an initial structure
  • Selecting this command will bring up the model selection form
  • In this form you can select the configured branch plans, and set the arguments before applying a branch plan.
  • Let’s create a Basic Branch plan in a subfolder Basic. This is done by changing the argument RootFolder to $/Ranger_Sandbox/Willy/BasicDemo and clicking Apply.
  • The form shifts to report the progress of applying the selected Branch plan
  • Once completed you can close the form and take a look in source control explorer at the new branch and folder structure of your new Basic folder

How does it work

The Visual Studio Extension is built on top of the same engine as the command line utility.

The Engine offers two core services to its clients. The First is a Branch Plan Catalog Service listing and providing information like Name, Description and the defined arguments for all available branch plans.

The second service is the Execution Engine that takes a list of arguments and a branch plan and simply executes the selected Branch Plan.

The Execution Engine is based on the **Microsoft Extensions Framework **and a defined schema for defining branch plans. This makes solution very configurable and extensible. The Engine simple assemblies and execute them, as defined in the .branchplan files. Each Action in the .branchplan corresponds to an MEF extended class in an assembly. There are a limited set of Actions provided (and needed) to create the source control structure needed to comply with the different branch plans.

The core actions provided are:

  • Connect to source Control
  • Create Folder
  • Create Branch
  • Check-In to source control

If you want you could easily add your own actions by building a MEF extended assembly, place the assembly in the same directory, and add your action to the .branchplan file.



Future plans

  • Video on https://channel9.msdn.com/ which explores and explains the design behind this quick response solution
  • Work with the ALM Rangers / ALM MVPs to extend the tooling for the community

More ideas?


Related Posts


Discussion is closed.

Feedback usabilla icon