Reputation: 16959
I have a build definition which includes the Archive step and I want to name the archive file using the following date format:
$(Date:yyyyMMdd).zip
However the build doesn't replace the filename with the date instead it creates a file called
$(Date
Is there a way to specify a time format for the zip file in the Archive step?
Upvotes: 0
Views: 234
Reputation: 41655
You can't use the $(Date:yyyyMMdd)
in the Archive step becuase the $(Date:yyyyMMdd)
is a token for Build number format, not a variable.
You have 2 options:
Like you said, put it in the build number and use the $(Build.BuildNumber)
.
Add a PowerShell task with this script (you can use inline) before the Archive task:
$date=$(Get-Date -Format g);
Write-Host "##vso[task.setvariable variable=currentDate]$date"
And in the Archive task use the variable $(currentDate)
.
Upvotes: 3