Skip to content

TeamCity display version number with TC build number #1367

Closed
@RobSmyth

Description

@RobSmyth

I've been able to include the TeamCity (TC) build number in the AssemblyInformationVersion (see issue 1358) but now I need TC to show an abbreviated version with the TC build number.

Why? - I need traceability to the TC build as a commit may be build multiple times. Technically I have that but I want the TC UI to shown both the built version, pre-release info, and always the build number.

Withing the Visual Studio solution I've added:

<!-- If being build by TeamCity, notify TC of the version number -->
  <Target Name="TeamCity" AfterTargets="Build" Condition=" '$(TeamCityBuild)'=='true'">
    <GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
      <Output TaskParameter="Assemblies" ItemName="AssemblyIdentity" />
    </GetAssemblyIdentity>
    <Message Text="##teamcity[buildNumber '%(AssemblyIdentity.Version)+Build.$(BUILD_NUMBER)']" />
  </Target>

On a release branch build I get (good):

#1.0.0.0+Build.92

But on a beta build I get something like:

#1.0.0-Beta.1+16

What I want, for a beta build is:

#1.0.0-Beta.Build.92

How can I do this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions