Skip to content

Expand Variable

Jesse Houwing edited this page May 7, 2016 · 6 revisions

The task is as simple as it's purpose. You tell it which variable to expand, and that's what it does.

Background

When you define a variable in the Variables screen and use other variables as value, they won't be expanded (as you may have expected). Instead the literal text is passed to the tasks in the workflow. Without this little task the following configuration won't work if you're on an older revision of the Build Agent. In recent versions of the agent variables will automatically expand.

Variable Value
Build.DropLocation \\share\drops$(Build.DefinitionName)$(Build.BuildNumber)

By adding the Expand variable(s) task to the top of your workflow, it will take care of the expansion, so any task below it will receive the value you're after.

Note

The task has limited support for recursive nesting. Depending on the complexity of your nesting, the task may not fully expand your variables.

Configuration

  • Variable Name(s) - Specify one or more variable names, separated by ,, ; or newline. Do not add $(..), as this will not use the variable name, but its value. Enter * to expand all variables.

Compatibility

This task relies on features only available in the Windows Powershell task host and can't be made available on other platforms.