在 Team City 中,有构建计数器的概念。每次执行构建时计数器都会递增,并且其范围仅限于单个构建定义 - 因此调用构建定义 A 不会更新构建定义 B 的计数器,反之亦然。
在 Visual Studio Team Services(以前是 Visual Studio Online)构建中,有一个 $Env:BUILD_BUILDNUMBER,但该数字似乎在全局范围内适用于所有构建定义。
为了使用 semver major.minor.patch
标记我的构建和后续 nuget 包,我希望访问类似于构建计数器的 teamcity,其范围仅限于单个构建定义。
我不想使用脚本来更新每个构建存储中的某些文件或基于 http 的文件,这感觉对于 Team City 中开箱即用的简单东西来说需要做很多工作。
最佳答案
您可以更新构建定义设置中“常规”选项卡下的“构建号格式”,以使用“$(Rev:.r)”作为构建号,如下所示:
major.minor$(Rev:.r)
Use $(Rev:.rr) to ensure that every completed build has a unique name. When a build is completed, if nothing else in the build number has changed, the Rev integer value is incremented by one.
If you want to show prefix zeros in the number, you can add additional r characters. For example, specify $(rev:.rr) if you want the Rev number to begin with 01, 02, and so on.
详细信息请参阅此链接:Build Number Format .
关于tfs - 构建计数器 - Visual Studio 团队服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39266347/