Setting a TeamCity Build Number from Console
To set a custom build number directly, specify a buildNumber message using the following format:
##teamcity[buildNumber '<new build number>']
In the
##teamcity[buildNumber '1.2.3_{build.number}-ent']
Getting Command Line and TeamCity to pass values between each other
Write
echo "%build.number%" > \last-successful-build-version.txt
Writes the build number to a file in the build agent.
Read
$ver = get-content \last-successful-build-version.txt
write-host "##teamcity[setParameter name='version_to_deploy' value='${ver}']"
Reads the value from the written file back in to TeamCity parameters.