My team has long been using a build process that always builds from a the same single branch.
The whole system is based around having low volume of work going on, so 1 person doing 1 task at a time is typical and I suppose this has been sufficient.
However I have been working on a major change that I would like to work on independently from other work and I would like to build this to one of our existing environments.
I noticed that in the build source settings I could change the Source Control Folder to point to my branch instead, but either due to how TFS builds work, or a how it was created here, the "main" branch name ends up being hard coded who knows how many levels deep into scripts called by scripts called by scripts..
I was hoping that I could create a single build definition that took the branch name as a parameter and I could use that everywhere the main branch was hard coded to create one "custom branch" build to rule them all, however when I try to put the parameter into the Source Control Folder path, it's not permitted:
$/BaseDir/$(BranchName)
With the error
The Path '$/BaseDir/$(BranchName)' contains a '$' at the beginning of a path component. Remove the '$' and try again.
This comes from the $(BranchName) part as the $ at the beginning was already there in the working version.
Is this a reasonable thing to do? How can I go about fixing this error, or is there a different way that this is supposed to be done?
This has always been a limitation of TFVC. It is not a limitation of Git due to fundamental differences in how branches function.
Dynamic workspace mapping is not possible with TFVC, in any iteration of the build system. And since TFVC is support-only and not being updated with new features, it will never be an option.
The paradigm for TFVC has always been to create a separate build for every branch. This is one of many reasons why Git-style feature branching workflows do not translate very well to TFVC.