BuildAgent.name捕获在变量中以用于条件语句 [英] BuildAgent.name capture in a variable to use for conditional statements

查看:66
本文介绍了BuildAgent.name捕获在变量中以用于条件语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试根据运行的代理程序加载prop文件。 

Trying to load prop files depending on Agent its running on. 

因此定义了作为序列作用域的变量,并将BuildAgent.Name分配给变量。但是当尝试从代理范围中访问变量时。变量值为空。   

So defined a variable scoped as sequence and assign the BuildAgent.Name to the variable. but when try to access the variable out of Agent scope .. Variable value is blank.   

推荐答案

您好tfs.Kumar,

Hi tfs.Kumar,

感谢您在此发帖。

请确保该变量与嵌套范围内的其他变量不冲突。

Please make sure that the variable doesn’t conflict with other variable in a nested scope.

请按照以下步骤设置代理变量xaml构建定义模板并获取代理名称: 

Please follow below steps for setting Agent variables in xaml build definition template and get Agent Name: 

1.您可以添加iBuildAgent类型变量。

1.You could add a iBuildAgent type variable.

2。添加GetEnvironmentVariable组件,选择Microsoft.TeamFoundation.Build.Client.IBuildAgent作为其类型。

2. Add a GetEnvironmentVariable compoment, select Microsoft.TeamFoundation.Build.Client.IBuildAgent as its type.

3。设置GetEnvironmentVariable的属性,如下图所示,Build Extensions:

3. Set the properties of GetEnvironmentVariable like the image below, Build Extensions:

WellKnownEnvironmentVariables 。BuildAgent结果:AgentDetail(之前确定的变量)

4.您可以通过以下方式获取代理商名称:
AgentDetail.Name

4.You could get Agent name by: AgentDetail.Name

最好的问候。


这篇关于BuildAgent.name捕获在变量中以用于条件语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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