简体   繁体   English

在2015 Xaml构建中引用BuildNumber

[英]Referencing BuildNumber in 2015 Xaml Builds

We are moving from tfs 2012 to tfs 2018 and converting our XAML build templates to 2015. 我们正在从tfs 2012迁移到tfs 2018,并将XAML构建模板转换为2015。

For the most part, using the default build template TfvcTemplate12 work well. 在大多数情况下,使用默认的生成模板TfvcTemplate12效果很好。 However when a project references the build number, it fails. 但是,当项目引用内部版本号时,它将失败。

One example is when we use the windows service publish task. 一个例子是当我们使用Windows服务发布任务时。

<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". 没有为“ WindowsServicePublishTask”任务提供必需参数“ BuildNumber”的值。

How can I reference the build number using TfvcTemplate12? 如何使用TfvcTemplate12引用内部版本号?

You are using the wrong environment variables. 您使用了错误的环境变量。 For XAML build: 对于XAML构建:

TF_BUILD_BUILDNUMBER The build number of the build. TF_BUILD_BUILDNUMBER构建的内部版本号。 For example: CIBuild_20130613.6 . 例如: CIBuild_20130613.6

More details please refer TF_BUILD environment variables 更多详细信息请参考TF_BUILD环境变量

You can use the TF_BUILD environment variables to get key bits of data that you need for your build process logic. 您可以使用TF_BUILD环境变量来获取构建过程逻辑所需的数据关键位。 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 TF_BUILD环境变量
  • Use environment variables in MSBuild 在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: 向MSBuild参数添加类似以下选项的示例:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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