Nick
Nick

Reputation: 871

Referencing BuildNumber in 2015 Xaml Builds

We are moving from tfs 2012 to tfs 2018 and converting our XAML build templates to 2015.

For the most part, using the default build template TfvcTemplate12 work well. However when a project references the build number, it fails.

One example is when we use the windows service publish task.

<WindowsServicePublishTask Publish="$(DeployFileService)" ServiceDisplayName="$(ServiceDisplayName)" Destinations="$(ServiceDestinations)" SourcePath="$(OutDir)" BuildNumber="$(BuildNumber)" CreateDropFolder="$(CreateDropFolder)" />

I get the following error

The "WindowsServicePublishTask" task was not given a value for the required parameter "BuildNumber".

How can I reference the build number using TfvcTemplate12?

Upvotes: 0

Views: 87

Answers (1)

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51093

You are using the wrong environment variables. For XAML build:

TF_BUILD_BUILDNUMBER The build number of the build. For example: CIBuild_20130613.6.

More details please refer TF_BUILD environment variables

You can use the TF_BUILD environment variables to get key bits of data that you need for your build process logic. For example, you can get the path to the source folder or the path to the folder that contains the outputs you want to drop.

  • TF_BUILD environment variables
  • Use environment variables in MSBuild
  • Use environment variables in programs or scripts
  • Use environment variables in a custom build process

A sample of adding something like the following options to the MSBuild arguments:

/p:DeployOnBuild=true;DeployMethod=Package /p:DefaultPackageOutputDir=”$(TF_BUILD_BINARIESDIRECTORY)”\WebPackage

Upvotes: 1

Related Questions