3
votes

I am using Release Management 2015 and doing Agent deploys. I want to access the TFS Build Number and use it as part of my deployment. The RM documentation says that starting with RM 2013 U4, system variables are available for use. The documentation implies that they are available to any type of deployment, however, I've read that they are only available to vNext (agent-less) deployments.

Unfortunately, there are no examples to give any guidance on how to access them. Does anyone have an example of how to reference a System variable in a deployment template?

2

2 Answers

2
votes

You can access the build number in a Component in an agent-based release template by referencing it as $(BuildNumber). You must pass $(BuildNumber) as a parameter to the component, which means defining a __Build Number__ parameter and passing the value in. Naturally, you must also be using a release template that is tied to a TFS build definition.

The user-definable system variables in Release Management are for vNext releases, not agent-based releases.

0
votes

In your vNext Release Template add a Deploy Using PS/DSC action; set this action to execute a PowerShell script. In that script you have access to almost all system variables:

Write-Verbose "BuildNumber = $($BuildNumber)" -Verbose