I am trying to set the build number format in Teamcity using Powershell (sort of like in this Octopus Deploy post).
However, I don’t know if Teamcity’s behavior with service messages has changed since then or if I am doing it wrong because it doesn’t work.
I have the following Powershell script as the first step in my build configuration:
$buildCounter = "%build.counter%"
$buildConfig = "%system.buildconfig%"
$version = "%system.majorMinorVersion%"
$branch = "%vcsroot.branch%"
if ($branch.Contains("/"))
{
$branch = $branch.substring($branch.lastIndexOf("/")).trim("/")
}
$buildNumber = "${version}.${buildCounter}-${branch}"
Write-Host "##teamcity[buildNumber '$buildNumber']"
(I also tried $branch = "%teamcity.build.branch%"on line 5)
, , if , , , Octopus Deploy, , $branch %vcsroot.branch%, , , Teamcity ##teamcity[buildNumber '$buildNumber']. , /, , refs/head/master, master.
?