In the TFS build definition, I am trying to use this build number format: $(GITVERSION.SemVer).Build-$(Build.BuildId)
As the build starts, $(Build.BuildId) is replaced correctly. But later GitVersion is replacing the whole thing with the generated semantic version - ie. I am losing the .Build-12345 suffix.
I think this is not a correct behaviour - gitversion should replace only the $(GITVERSION.SemVer) part, leaving the rest of the build number untouched. TFS configuration as TFS users expect it to work should be respected.
Using bare semver for build number is not satisfactory, because build artifacts depend not only on the source code, but also on the version of the build definition and its parameters and possibly other things too (in real life builds may not be quite repeatable, which of course is not proper ALM, but it happens). BuildId is unique and having it in the build number allows to differentiate the output of different builds from the same commit.