是否可以在构建步骤中获得TFS Build Agent用户功能的值? [英] Are TFS Build Agent User Capabilities' Values Obtainable Within Build Steps?

查看:75
本文介绍了是否可以在构建步骤中获得TFS Build Agent用户功能的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在TFS中编写一个构建步骤,它依赖于了解Build代理将nuget.exe存储在哪里(标准nuget-install步骤会弄乱参数的顺序,从而破坏了构建的执行,所以我想自己使用batch / shell / ps步骤之一运行exe。)

I'm trying to write a build step within TFS that relies on knowing where the Build agent has nuget.exe stored (the standard nuget-install step mucks around with the order of arguments in a way that breaks build execution, so I want to run the exe myself using one of the batch/shell/ps steps).

似乎在Build Agent上通过该路径设置功能会很有道理,但是我似乎无法在任何构建步骤中引用该值,并且在MSDN上找不到任何有用的东西。

It would seem that setting up a capability on the Build Agent with that path would make sense, but I cannot seem to reference the value in any of my build steps, and I cannot find anything helpful on MSDN.

我希望它类似于 $(Env.MyUserCapability),但是它永远不会解决值。

I'm expecting it to be something like $(Env.MyUserCapability), but it never resolves to the value.

是否可以在构建步骤中检索功能值?如果是这样,您该怎么做?如果不是,那么可行的替代方法是什么?

Is it possible to retrieve a capability value within a build step? And if so, how do you do it? And if not, what is a viable alternative?

推荐答案

用户定义的功能仅是元数据。但是您可以设置一个全局环境变量(例如 NUGET )并将其设置为 nuget.exe 的路径,重新启动代理时,将发现整个计算机范围的环境具有功能,然后就可以使用它。

The user-defined capabilities are metadata only. But you can set a global environment variable (e.g. NUGET) and set that to a path to a nuget.exe, when you restart the agent, the machine-wide environment is then discovered as capability and you can then use it.

如果要编写自定义任务,还可以添加 nuget.exe 到将下载到执行代理的任务。

If you are writing a custom task, you can also add a nuget.exe to the task that will be downloaded to the executing agent.

这篇关于是否可以在构建步骤中获得TFS Build Agent用户功能的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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