TeamCity:使用工件的文件版本标记VCS(Subversion)

dr.*_*vil 3 svn teamcity continuous-integration label build-server

我想在SVN中创建一个带有文件版本的标签(标签).

我已经通过获取构建生成的主要可执行文件的文件版本来重命名工件.如:MyInstaller-1.2.3.1.exe.现在我想在SVN中创建一个名为的标签/tags/1.2.3.1.我找不到在标签模式中设置这样的东西的方法.

目前我的标签只是"%system.build.number%"

有关如何做到这一点的任何想法?

我正在使用TeamCity Professional Version 4.5.3(build 9035)

syl*_*aar 6

正如有人提到的,您可以在构建脚本执行期间输出构建号,teamcity将使用该输出来标记构建.例如,我使用与AssemblyInfo.cs相同的版本标记我的构建.该版本的一部分(Major,Minor)实际上已经在文件中,另一部分(Build,Revision)在构建期间被添加.

从我的msbuild脚本:

<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>
Run Code Online (Sandbox Code Playgroud)

您只需在构建格式期间输出版本 ##teamcity[buildNumber '<buildnum>']