Today I was having a look at a build pipeline of one of my clients. On this specific project there are still using Team Foundation Version Control(TFVC) which is still supported in Azure DevOps.
If you don't remember TFVC(or never used it before), one of the differences between TFVC and Git is the way it handles branches. In Git a branch is a pointer to a commit whereas in TFVC a branch is visualized as a separate folder in your source control tree.
In the image above we have a Main branch and a branch per release in the Release folder. You can map this folder structure to your local file system through a workspace mapping. This allows you to have multiple branches available and active at the same time on your local machine.
When using TFVC in your build pipeline, you also need to configure a workspace mapping to specify which folders should be downloaded and mapped on the file system of the build server.
Notice that I'm hardcoding the Release number(2.5) in the Server path. The trick that I discovered today is that it is possible to use build pipeline variables here. So I can define a version
variable:
And update the server path to use this variable:
Now next time a new release branch is created, I only need to update the version
variable. Nice!