TFS 如何获取环境变量值 [英] TFS How to GetEnvironmentVariable value

查看:34
本文介绍了TFS 如何获取环境变量值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 tfs 构建中,我创建了一个参数,我将其传入 $(TF_BUILD_BUILDDIRECTORY)

In my tfs build I've created an argument to which I pass in $(TF_BUILD_BUILDDIRECTORY)

然后在我的 xaml 文件中,我添加了一个名为test1"的变量并添加了 GetEnvirenmentVariable 步骤,我想在其中存储

Then in my xaml file I've added a variable called "test1" and added GetEnvirenmentVariable" step where I would like to store value of

TF_BUILD_BUILDDIRECTORY

TF_BUILD_BUILDDIRECTORY

我无法获得价值.我的构建的输出:

I can NOT get the value to come through. Output from my build:

它打印 $(TF_BUILD_BUILDDIRECTORY) 而不是 "C:\temp... etc"

It prints $(TF_BUILD_BUILDDIRECTORY) instead of "C:\temp... etc"

请帮忙!谢谢

推荐答案

参考 这个 MSDN 文档:

使用来自自定义构建过程的环境数据

如果您需要在 自定义构建中使用环境变量流程模板,您可以使用GetEnvironmentVariable 活动来获取数据.您可以从任何WellKnownEnvironmentVariables.

If you need to use an environment variable in your custom build process template, you can use the GetEnvironmentVariable activity to get the data. You can get data from any of the WellKnownEnvironmentVariables.

例如,要获取二进制文件目录的路径,请设置名称GetEnvironmentVariable 活动的属性Microsoft.TeamFoundation.Build.Activities.Extensions.WellKnownEnvironmentVariables.BinariesDirectory

For example, to get the path to the binaries directory, set the Name property of the GetEnvironmentVariable activity to Microsoft.TeamFoundation.Build.Activities.Extensions.WellKnownEnvironmentVariables.BinariesDirectory

<小时>

请按照以下步骤操作:


Please follow the below steps:

  1. 创建一个名为:BIARIESDIRECTORY 的字符串变量.
  2. 添加 GetEnvironmentVariable (String) 活动,设置 Name = Microsoft.TeamFoundation.Build.Activities.Extensions.WellKnownEnvironmentVariables.BinariesDirectory结果 = BINARIESDIRECTORY
  3. 添加 CopyDirectory 活动,设置 Source = BINARIESDIRECTORY 和目的地 = \servername\drop"
  1. Create a String variable named: BINARIESDIRECTORY.
  2. Add GetEnvironmentVariable (String) activity, set Name = Microsoft.TeamFoundation.Build.Activities.Extensions.WellKnownEnvironmentVariables.BinariesDirectory and Result = BINARIESDIRECTORY
  3. Add CopyDirectory activity, set Source = BINARIESDIRECTORY and Destination = "\servername\drop"

这篇关于TFS 如何获取环境变量值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆