JL.
JL.

Reputation: 81262

TFS Buildnumber how to sync with environment variable?

According to documentation : https://msdn.microsoft.com/en-us/library/vs/alm/build/scripts/variables

It should be possible to persist the build value inside an environment variable:

Build.BuildNumber (BUILD_BUILDNUMBER)

I've created this environment variable, now I want to persist a value there, so I've set it to, for example: 1.0.0.1

How can I get the Build number format in general tab to sync to the environment variable?

Upvotes: 0

Views: 538

Answers (3)

BossHogg
BossHogg

Reputation: 23

You can also use powershell to version the assemblies, then check those files back into TFS to maintain the version numbers.

Use a PowerShell script to customize your build process

Upvotes: 0

Eddie Chen - MSFT
Eddie Chen - MSFT

Reputation: 29968

The build service only use the Environment variable when the variable value is blank:

Environment variables on the agent. If variables is referenced and there is no value specified we will use Environment variables to try and fill in the value.

However, Build.BuildNumber variable is filled with value as soon as the build starts. So there isn't any way to do this for Build.BuildNumber variable.

Upvotes: 0

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51083

This question seems related with How to permanently save a build variable as a build step?. I have added an answer in the link for your reference.

Well, there is no way to get the build number format to sync to the environment variable such as (BUILD_BUILDNUMBER) in general tab.

If you want to generate a custom build number you can refer the paragraph of Generating a custom build number in this link.

Upvotes: 1

Related Questions