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

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

问题描述

我正在尝试在 TFS 中编写一个构建步骤,该步骤依赖于知道构建代理将 nuget.exe 存储在哪里(标准的 nuget-install 步骤以破坏构建执行的方式混淆了参数的顺序,所以我想使用批处理/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).

使用该路径在构建代理上设置功能似乎是有意义的,但我似乎无法在任何构建步骤中引用该值,并且在 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 构建代理用户能力的值是否可在构建步骤中获得?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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