I'm using Visual Studio TFS Services and want to run a powershell, update a variable and use it in another task.
My build definition only has 2 powershell tasks and 1 variable (NugetEnabled) with default value "dontpush".
Build variables: NugetEnabled (value: "dontpush")
Task 1: Powershell Script
##vso[task.setvariable variable=NugetEnabled;]push
Task 2: Powershell Script
$value= $env:NugetEnabled
if ($value)
{
Write-Output "Value of the nuget is set and equals to $value"
}
else
{
Write-Output "Value of the nuget doesn't exists."
}
The output console writes:
"Value of the nuget is set and equals to dontpush"
Expected value: "push".
I'm not able to update the value. I want to update the value because I want to use a "Custom condition" to push my nuget package.
The complete powershell script is hosted in github and my agent version is 2.116.1
Thanks in advance! Any advice will be apreciated and useful.
Write-Output ("##vso[task.setvariable variable=NugetEnabled;]push")and works perfect!...