I've got TeamCity building a configuration across multiple Mercurial branches. As part of the build process, I want to name some output based on the branch being built from.
I've tried using $(TEAMCITY_BUILD_BRANCH)
, to try to obtain the teamcity.build.branch
property from TeamCity, but I only get an empty string. I successfully used $(BUILD_NUMBER)
to get the build.number
property into the script, so I'm a little confused to what is required.
Just create a build parameter:
system.branch_name = %teamcity.build.vcs.branch.Your_Project%
Any non-alpha-numerical chars in the project name should be replaced by "_".
In your msbuild use $(branch_name)
to reference the parameter.
Works like charm :-)