tfs - 构建计数器 - Visual Studio 团队服务

标签 tfs teamcity azure-devops tfsbuild

在 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/

相关文章:

teamcity - 如何在 TeamCity 中将代码覆盖率阈值设置为高水位线?

TeamCity PowerShell Runner 无法识别 PowerShell 社区扩展

azure - 错误: The requested resource requires user authentication: in AzureCLI task build pipeline

tfs - 如何从 Team Foundation Server 锁定文件?

c# - 如何检测 TFS 项目源代码已被修改

git - VS 中的 TFS/GIT 无法切换到 master,因为有未提交的更改

teamcity - 通过 SVN 中的 checkin 评论更新问题上的 YouTrack 状态

git - 连接到 TFS 或 Visual Studio Online 中的 git 存储库

Azure Synapse - 在笔记本中导入 python 脚本

Azure DevOps Pipeline - 推送到 Azure 容器注册表 - 权限错误