Teamcity Serial Number Generator

Teamcity currently generates build numbers in 1.0.0 format. [SVN REVISION], which he sends to MSBUILD.

I need to change this to 1.0 format. [SVN REVISION], where we insert the de-punctured version of the dependent dll into. For example, if our dependent dll is version 1.2.3.4, the generated assembly number will be 1.0.1234. [SVN REVSION].

The dependent dll is part of the build source, so I was hoping I could do something with the build options and a little exe that combines it for version information but sees no way to enable this through the user interface.

Any ideas if possible?

+4
source share
1 answer

You can output the assembly number during the execution of the script assembly, and teamcity will use this output to mark the assembly. For example, I put my assembly in the same version as in AssemblyInfo.cs. Part of this version (Major, Minor) is actually in the file, another part (Build, Revision) is added during the build.

From my msbuild script:

<Target Name="Setup"> <!-- Version.txt contains the major and minor version numbers, The build number and revision come from environment variables in the next step --> <Version VersionFile="Version.txt" BuildType="None" RevisionType="None"> <Output TaskParameter="Major" PropertyName="Major" /> <Output TaskParameter="Minor" PropertyName="Minor" /> </Version> <!-- If you want to build a release without going through the build server, you should define the following 2 environment variables when running this build script --> <!-- BUILD_NUMBER environment variable supplied by the build server --> <CreateProperty Value="$(BUILD_NUMBER)"> <Output TaskParameter="Value" PropertyName="Build" /> </CreateProperty> <!-- BUILD_VCS_NUMBER environment variable supplied by the build server --> <CreateProperty Value="$(BUILD_VCS_NUMBER)"> <Output TaskParameter="Value" PropertyName="Revision" /> </CreateProperty> <AssemblyInfo CodeLanguage="CS" OutputFile="Properties\VersionInfo.cs" AssemblyVersion="$(Major).$(Minor).$(Build).$(Revision)" AssemblyFileVersion="$(Major).$(Minor).$(Build).$(Revision)" /> <!-- Tell the build server what our actual build number is --> <Message Text="##teamcity[buildNumber '$(Major).$(Minor).$(Build).$(Revision)']" /> </Target> 

you just output the version at build time, format ##teamcity[buildNumber '<buildnum>']

+10
source

Source: https://habr.com/ru/post/1379127/


All Articles