ApplyVersionToAssemblies.ps1 Script usage Steps with TFS 2013 Build

May 14, 2015 at 10:36 AM
Dear Team,

Kindly advice :

followed below steps,
  • Downloaded ApplyVersionToAssemblies.ps1
  • Added to TFS Under team project
  • Selected the ApplyVersionToAssemblies.ps1 script as a Pre Build activity in TFS 2013 Build
    definitions from Process wizard
  • Finally executed the build (Firing the build from TFS Build machine itself)
Build has failed with following error :

C:\Builds\18\XXX....\Assemblyinfo\ApplyVersionToAssem
blies.ps1 : Could not find version number data in TF_BUILD_BUILDNUMBER.
  • CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorExcep
    tion
  • FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio
    n,ApplyVersionToAssemblies.ps1
(I even tried specifying TF_BUILD_BUILDNUMBER & TF_BUILD_SOURCEDIRECTRY as environmental variables though it is a build machine)

Kindly advice me on this.

Thank a lot in advance.

Tarun
May 19, 2015 at 12:02 PM
Hi,

What's the value in the 'Build number format' build process parameter?

Make sure it contains some value with the format: "\d+.\d+.\d+.\d+".
Something like this should work: $(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)

Thanks,
HG.