Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to manually update the build variable $(Build.BuildId)

Tags:

azure-devops

I am helping a friend with their VSTS build and we are using both build identifiers

  • $(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
  • Result = 1.0.0 (148)

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.

like image 460
Skye Hoefling Avatar asked Oct 15 '25 03:10

Skye Hoefling


1 Answers

No, it’s impossible.

The predefined variable Build.BuildId value is unique to record echo build in the VSTS account.

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.

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.

The work around is using a user defined variable instead Build.BuildId:

Add a user defined variable such as custom.BuildId and set the value with ($(Build.BuildID)+GapNumber).

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.

enter image description here

For next build. The custom.BuildId value will be 1149.

like image 139
Marina Liu Avatar answered Oct 19 '25 17:10

Marina Liu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!