问题描述
我正在帮助一个朋友进行VSTS构建,我们正在使用这两个构建标识符
I am helping a friend with their VSTS build and we are using both build identifiers
- $(Build.BuildId)
- $(Build.BuildNumber)
这是特定于Xamarin.iOS构建的,其中我们使用新的VSTS Build任务来更新Info.Plist.我们需要使用$(Build.BuildId)作为版本代码,它只是一个递增的数字.然后,我们要使用$(Build.BuildNumber)作为实际的版本名称.如果要将其格式化为构建字符串,则将如下所示:
This is specific to a Xamarin.iOS build where we are using the new VSTS Build tasks for updating the Info.Plist. We need to use the $(Build.BuildId) for the version code which is just a number that increments. Then we want to use the $(Build.BuildNumber) for the actual Version Name. If was to format this into the build string it would look like this:
-
$(Build.BuildNumber)
= 1.0.0 -
$(Build.BuildId)
= 148 - 结果= 1.0.0(148)
$(Build.BuildNumber)
= 1.0.0$(Build.BuildId)
= 148- Result = 1.0.0 (148)
问题是,我们已经将应用提交到应用商店的应用中,其构建ID比当前构建的ID大.与其运行构建X多次以使其同步,我们不希望手动更新BuildId,这样我们就可以在整个工作流程中开始使用它.
The problem is we have already submitted our app to the app store with a larger build ID then what our current build is at. Instead of running the build X number of times to sync it up we would like to manually update the BuildId so we can start using this for our full workflow.
推荐答案
不,这不可能.
预定义变量Build.BuildId
的值对于记录VSTS帐户中的回声生成是唯一的.
The predefined variable Build.BuildId
value is unique to record echo build in the VSTS account.
即使您可以通过logging命令更改值,但它仅适用于当前版本,当您在下一个版本排队时,版本ID将继续增加而没有任何作用.
Even you can change the value by logging command, but it can only work for the current build, when you queue next the build, the build ID will continue increased without any effect.
即使当前Build.BuildId
为148,即使您在构建中将Write-Host "##vso[task.setvariable variable=Build.BuildId]2148"
的值使用100,但是当另一个构建排队时,Build.BuildId
也将为149.
Such as current Build.BuildId
is 148, even if you use the value to 100 by Write-Host "##vso[task.setvariable variable=Build.BuildId]2148"
in a build, but when another build is queued, the Build.BuildId
will be 149.
解决方法是使用用户定义的变量代替Build.BuildId
:
The work around is using a user defined variable instead Build.BuildId
:
添加用户定义的变量,例如custom.BuildId
,并使用($(Build.BuildID)+GapNumber)
设置值.
Add a user defined variable such as custom.BuildId
and set the value with ($(Build.BuildID)+GapNumber)
.
就像当前的Build.BuildID
是148,而您在应用商店中提交的内部版本ID是2148,因此可以将custom.BuildId
与值($(Build.BuildID)+2000)
一起使用.然后为您的应用程序使用变量$(custom.BuildId)
和$(Build.BuildNumber)
.
Such as if the current Build.BuildID
is 148, while the build ID you submitted in app store is 2148, so you can use the custom.BuildId
with the value ($(Build.BuildID)+2000)
. Then use the variables $(custom.BuildId)
and $(Build.BuildNumber)
for your app.
用于下一个版本. custom.BuildId
值为1149.
For next build. The custom.BuildId
value will be 1149.
这篇关于是否可以手动更新构建变量$(Build.BuildId)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!