We use TFS source control and have two build controllers (one VS2010 the other VS2012). We use the default build workflow template bar a few custom changes.
As we have many branches, how would we go about changing the workspace based on the desired branch?
I was thinking of adding a parameter for the branch ($\oursourcecontrol\branches\main
) and then just passing it as a variable in to the get workspace part of the workflow.
Or is there a better way of doing it?
Create a new branch for your code that starts with feature/, e.g., feature/feature-123. Make a change to your code in the feature branch and commit the change. Navigate to the Pipelines menu in Azure Pipelines or TFS and select Builds. Select the build pipeline for this repo.
A build definition consists of a series of Tasks which is executed during an automated build process. Examples of the tasks can consist of running a Visual Studio Build, MS Build, executing PowerShell or Shell scripts etc. 1) To create a Build Definition, login to TFS web interface and go to the Builds TAB. Click on + to create a build definition.
You can use a single build with multiple branches and skip or perform certain tasks based on conditions. Edit the azure-pipelines.yml file in your main branch, locate a task in your YAML file, and add a condition to it. For example, the following snippet adds a condition to publish artifacts task. YAML builds are not yet available on TFS.
We will now take a look at how Team Foundation Server (TFS) will be used to Build, Test and Deploy .NET Web Applications which is traditionally the strength of the tool. Microsoft Visual Studio .NET 2015 (30-day trial version)
You currently can't and it is really a shame. It would completely break the Trigger support for CI and Gates checkins. You can use the TFS Community Build Manager to quickly clone and adjust build definitions to support multiple branches though.
What you could do, is to fetch more than you need (say $/Sourcecontrol/Branches/*
) and then use a string-replace on any path parameter (like solutions to build, test settings file etc) to point them all to the correct solution. You'll probably need to do some templating like {BRANCH}
so that you can easily replace these tokens.
The Git build template does support this on a Git repository, but you'd need TFS 2013 to make use of server side Git support.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With