tRuEsAtM
tRuEsAtM

Reputation: 3668

How to update AssemblyVersion using Update Assembly Info plugin in VSTS?

I want to update the version number of my .exe file using Update Assembly Info plugin. I am using the following configuration: enter image description here

But, I keep getting an error '$(Date:yyyy.MM.dd)$(Rev:.r)' is not a valid parameter for attribute 'AssemblyVersion'

Upvotes: 1

Views: 1786

Answers (1)

starian chen-MSFT
starian chen-MSFT

Reputation: 33698

The $(Date:yyyy.MM.dd) and $(Rev:.r) can’t be used as the build-in variable, it can be used in Build number format (Options tab).

The workaround is that:

  1. Include $(Rev:.r) in Build number format, such as $(date:yyyyMMdd)$(rev:.r)
  2. Add PowerShell task to add a new variable (Arguments: -bn $(Build.BuildNumber)

Script:

param(
[string]$bn
)
$d=Get-Date -Format "yyyyMMdd"
$r=$bn.split("{.}")[-1]
Write-Host "##vso[task.setvariable variable=currentVersion]$d$r"
  1. Then use currentVersion variable in subsequent tasks, such as Update Assembly task.

Upvotes: 2

Related Questions