TeamCity build number reporting from MSBuild


I'm reporting a build number to TeamCity from my MSBuild script using the following TeamCity task:

<TeamCitySetBuildNumber Condition="'$(TEAMCITY_BUILD_PROPERTIES_FILE)' != '' " BuildNumber="$(UpdatedVersionInfo)" />

This is called from an UpdateVersion task which generates UpdatedVersionInfo from a GlobalAssemblyInfo.cs  This all works fine when the build succeeds, however if the build fails early in the process, TeamCity displays the build number set in the 'General Settings' tab, e.g. 1.0.0.{0}  Is there anyway around this as the build number has to be generated from the build script, rather than TeamCity.

Also, TeamCity will display the General Settings build number in the UI and tray notification app, right up until the point that the actual build number is reported by the script, even though the number is reported in a target defined in the InitialTargets attribute of the Project element.

Is there any way around this?


Please sign in to leave a comment.