如何将内部版本号格式应用于 tfs 中的搁置集构建?

How to apply the build number format to shelveset builds in tfs?

我有一个 TFS 构建定义

Process > Basic > Build Number Format参数设置为

1.1.2-alpha$(Rev:.r)

每当我从 'Latest Sources' 构建并且构建代理应用正确的版本号(1.1.2-alpha1 等)时,这工作正常。但是,当我尝试从具有相同构建定义的搁置集构建时,构建失败并出现以下错误:

'31927' is not a valid version string.

那么,如何确保构建代理在从搁置集构建时应用相同的命名模式?

错误信息:

错误是由您的构建过程中的 nuget pack 任务引起的。您使用内部版本号对 nuget 包进行版本控制,但内部版本号“31927”不符合 Nuget Versioning.

当您使用搁置集对构建进行排队时,构建编号始终使用以下格式:构建 N。它不会读取您在 "Build Number Format" 中配置的设置。详情参考这个link:Private Build.

The completed build is named by using the format Build N where N is a unique integer value. This format differs from that of public builds, which you specify by using the Build Number Format parameter.

这意味着,为了避免这个问题,您需要使用一些其他方法来对您的 nuget 包进行版本控制。