2
votes

My goal is to update the AssemblyInfo.cs version information in my project with a version number that is derived from the build definition / build number that is generated by TFS. For example, the first build that runs on 2013-01-20 would be 2013.1.2.1.

Further, I am using the Microsoft hosted TFS (now known as Visual Studio Team Services), and am using the AzureContinuousDeployment.11.xaml build process. This was automatically setup when I linked Azure to TFS.

Information from http://msdn.microsoft.com/en-us/library/vstudio/dn376353.aspx#scripts implies that I can run a Powershell script as a pre-build task, and I'd like to use the one from https://tfsbuildextensions.codeplex.com/SourceControl/latest#Scripts/ApplyVersionToAssemblies.ps1

However, I don't see the Pre-Build Script options available for my given build definition.

Is this a limitation of the Visual Studio Team Services, the particular build process or is there something that I am missing to enable or make visible these options?

I'd like to be able to apply the version in the easiest way possible (i.e. without modifying the build process if possible).

2

2 Answers

3
votes

The recommended approach is to customize the build template (AzureContinuousDeployement.11.xaml) and add in the custom TFSVersion activity from the TFS Community Build Extensions that will handle this.

If you've never customized a TFS Build Template before you can learn about the process in the ALM Rangers Build Guidance

3
votes

If you don't require the AzureContinuousDeployment.11.xaml build process template you could change it to the TfvcTemplate.12.xaml build process template which does include the Pre-Build Script options you're after.

enter image description here