简体   繁体   English

如何使用 Azure DevOps 控制我的内部版本号?

[英]How can I control my build number with Azure DevOps?

I get so many frustrations with Azure DevOps.我对 Azure DevOps 感到非常沮丧。 In my Build number format I would like to have both在我的内部版本号格式中,我想同时拥有

  • A number that restart to 0 when I update my major an minor version.当我将我的主要版本更新为次要版本时重新开始为 0 的数字。
  • But I also would like to have a real build number that is never reset whatever is my build number format.但我也希望有一个真实的内部版本号,无论我的内部版本号格式是什么,它都不会被重置。 This build number can also be shared by all my build pipeline of my project.这个内部版本号也可以由我的项目的所有构建管道共享。 Is it possible?可能吗?

I'm not using YAML format.我没有使用 YAML 格式。 I use the classic interfaces with the option page to set my build format.我使用带有选项页面的经典界面来设置我的构建格式。 At this moment I have this:此刻我有这个:

在此处输入图像描述

It work except each month the r number restart at 0. I want it to continue.它可以工作,除了每个月 r 编号从 0 重新开始。我希望它继续。

EDIT编辑

在此处输入图像描述

I still didn't decided my final format.我还没有决定我的最终格式。 I would like to understand all the possibilities.我想了解所有的可能性。 Now I discovered the $(BuildID) property I have another question.现在我发现了$(BuildID)属性,我还有一个问题。 Is it possible to have something similar to $(Rev:r) variable but that only check the left part of my build number.是否有可能有类似于$(Rev:r)变量的东西,但只检查我的内部版本号的左侧部分。

Example:例子:

4.16.$(SequenceFor[4.16]).$(BuildID)

In fact I would like to manually set the Major and Minor version and let the system update one by one the Build and use the Revision for the global $(BuildID) .事实上,我想手动设置 Major 和 Minor 版本,让系统一一更新 Build 并使用全局$(BuildID)的 Revision。

The $(rev:r) is restarted when the build number changes in any character, so this is the reason why it's restarted whenever the major/minor or the sate changed. $(rev:r)在任何字符的内部版本号更改时都会重新启动,因此这就是每当主要/次要或状态更改时它都会重新启动的原因。

So if you want to use an incremental unique number you can't use the $(rev:r) because then it will be restarted each build.因此,如果您想使用增量唯一编号,则不能使用$(rev:r) ,因为每次构建都会重新启动它。

If you want a number that depends on the major and the minor numbers you need to use the counter expression :如果您想要一个取决于主要和次要数字的数字,您需要使用counter 表达式

Create 2 variables:创建 2 个变量:

  1. major-minor = 4.16 major-minor = 4.16

And a variable that depends on his value and also is a counter:还有一个取决于他的值的变量,也是一个计数器:

  1. revision = $[ counter(variables['major-minor'],0) ] revision = $[ counter(variables['major-minor'],0) ]

在此处输入图像描述

The build number will be:内部版本号将是:

$(major-minor).$(revision).$(Build.BuildId)

Now, if you will change the major-minor (to 4.17 or 5.16 ) the revision will be again 0 .现在,如果您将更改major-minor (更改为4.175.16 ),则revision将再次0

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将版本 ID 和内部版本号提取到我的 Azure DevOps 部署的 PHP 应用程序中 - How can I pull the release ID and build number into my Azure DevOps deployed PHP app 如何通过 PowerShell 使用 Azure DevOps 的内部版本号更新 AssemblyInfo.cs 中的 AssemblyVersion 号? - How can I update AssemblyVersion number in AssemblyInfo.cs with build number of Azure DevOps via PowerShell? 如何在 Azure 上创建新的构建代理以与我的私有 DNS 和 Azure DevOps 上的发布管道进行通信? - How can I create a new build agent on Azure to communicate with my private DNS and the release pipline on Azure DevOps? 使用Azure DevOps REST Api,除列出所有内部版本外,如何通过内部版本号获取内部版本? - Using Azure DevOps REST Api how can I get the build by its build number, except by listing all the builds? Azure Devops API,如何判断代理是否正在运行构建? - Azure Devops API, How can I tell if an agent is running a build? 如何使用 azure devops 构建管道对 npm 注册表进行身份验证? - How can I authenticate a npm registry with azure devops build pipeline? 如何从 Azure Devops 中的特定分支构建? - How can I build from specific branch in Azure Devops? 如何使用 Bash 在 Azure DevOps 中设置构建变量? - How can I set a build variable in Azure DevOps with Bash? 我如何将数字构建从 Azure DevOps Pipelines 推送到文件 *.csproj(项目 ASP.NET CORE)? - How I can Push number build from Azure DevOps Pipelines to file *.csproj (project ASP.NET CORE)? 如何将内部版本号添加到Azure DevOps中的构建管道工件的名称中? - How do I get the build number into the name of the build pipeline artifact in Azure DevOps?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM