I have a simple powershell task in my pipeline definition to grab the date information and set some build variables
[string]$buildNum=$(Build.BuildNumber);
$year=$(Get-Date -Format yyyy);
$month=$(Get-Date -Format MM);
$day=$(Get-Date -Format dd);
$revnum= $buildNum.Substring($buildNum.LastIndexOf('.') + 1);
Write-Host "##vso[task.setvariable variable=major]$year$month"
Write-Host "##vso[task.setvariable variable=minor]$day"
Write-Host "##vso[task.setvariable variable=patch]$revnum"
The task keeps failing with:
##[error]Unable to process command '##vso[task.setvariable variable=major;]201910' successfully. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=817296)
[error]##vso[task.setvariable variable=major;] is not a recognized command for Task command extension. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=817296)
I have seen the syntax as both:
Write-Host "##vso[task.setvariable variable=major]$year$month"
and
Write-Host "##vso[task.setvariable variable=major;]$year$month"
both result in the same error.
Write-Host "......"
? – Yan Sklyarenko