简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM