XtianGIS
XtianGIS

Reputation: 1006

Is possible to pass a variable from a Build to a Release in TFS 2017?

A Build definition has a custom variable that can be set when a build is queued.

Is possible to have access to that variable from a Release in the same way that is possible to have access to variables like Build.DefinitionId, Build.DefinitionName, Build.BuildNumber ?

Upvotes: 2

Views: 4253

Answers (3)

Robin Dijkstra
Robin Dijkstra

Reputation: 113

I've managed to do this with an extension from the TFS marketplace, called 'Variable (de|re)Hydration Tasks', from naked Agility Ltd. This extension provides build- and release tasks with which you basically can save your build variables and restore them in your release. It does this by prefixes, so you can save/restore all default build variables that are prefixed with 'BUILD-', but if you prefix your own variables with i.e. 'ABC_' you can also save them from your build and restore them in your release.

Upvotes: 4

Tingting0929
Tingting0929

Reputation: 4202

A custom build variable couldn't be used in your release definition. Here is an user voice that similar to your problem: https://visualstudio.uservoice.com/forums/330519-team-services/suggestions/14515326-project-level-build-release-variables. You could vote and add comment below.

As a workaround, you could copy those build variables and their values to a Variable groups. Then add the Variable group to your release definition. This is a new feature in TFS 2017 Update1.

Upvotes: 2

Daniel Morritt
Daniel Morritt

Reputation: 1817

Have you tried just passing the variable into the task definition like $(MyVariable) (where MyVariable is the custom variable name)?

Upvotes: -3

Related Questions