Custom TFS Enviroment Variable doesn't read $(Date)

前端 未结 3 1457
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-11 23:13

I want to use a custom tfs variable like this:

MergedVersion: $(BuildVersion.Major).$(BuildVersion.Minor).$(Date:yy)$(DayOfYear)$(Rev:.r)

My pro

3条回答
  •  孤街浪徒
    2020-12-11 23:40

    Use following script in a PowerShell Task in your build definition

    $date=$(Get-Date -Format 'yy');
    Write-Host "##vso[task.setvariable variable=Today]$date"
    

    Then you can use $(Today) in your subsequent build tasks. However, usage like $(Today:yy) with format is not possible as it is supported only in build number format.

提交回复
热议问题