Deepak
Deepak

Reputation: 1592

How to get output variable's value in next VSTS task?

I'm using this command to set the output variable in a task-1

Write-Output ("##vso[task.setvariable variable= buildOutcome;]$buildOutcome")

and trying to access this variable using the following commands (in a series of tasks, task-3 is next to next of task-1)

$(buildOutcome)

$env:buildOutcome

$(task-1.buildOutcome)

But there is no output all variables value are null.

Any idea?

Upvotes: 0

Views: 508

Answers (1)

Daniel Mann
Daniel Mann

Reputation: 59055

You have a leading space between the equals sign and the variable name:

Write-Output ("##vso[task.setvariable variable= buildOutcome;]$buildOutcome")
#                                              ^ extraneous space

Remove it:

Write-Output ("##vso[task.setvariable variable=buildOutcome;]$buildOutcome")

Upvotes: 4

Related Questions