Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TFS build powershell script step : Not able to access $(Date:yyyyMMdd) variable

I had created auto deployment steps using TFS vNext build system. In one step I needs to access $(Date:yyyyMMdd) for some file versioning stuff.

Below you can find configuration and error snippet:

Configuration for power shell script step

Error while queuing build

So any idea how to access date related variables as argument in PowerShell script step ?

like image 428
Nilesh Moradiya Avatar asked Feb 06 '23 16:02

Nilesh Moradiya


1 Answers

"$(Date:yyyyMMdd)" is a token for Build number format, not a variable. So you cannot use it in the build steps.

The alternative way to do this is to set the "Build number format" under "General" tab to "$(Date:yyyyMMdd)", the variable "$(Build.BuildNumber)" will be filled with the value of "$(Date:yyyyMMdd)". And then you can use "$(Build.BuildNumber)" variable in the build steps.

like image 142
Eddie Chen - MSFT Avatar answered Feb 14 '23 08:02

Eddie Chen - MSFT