从构建中获取 BuildAgent 信息
我有一个 IBuildDetail 变量,其中包含我需要的构建信息。
好的,但是当我检查属性 BuildAgent 时,它显示以下内容: build.BuildAgent' 引发了类型为 'System.NotImplementedException 的异常
然后我尝试检查 build.BuildController.Agents,很高兴我找到了 BuildAgent,但有 7 个构建代理在这个集合中。我只需要与我的构建相关的构建代理,而不需要来自该控制器的所有构建代理。
有人知道如何获取该信息吗? (使用 IBuildDetail 变量选择构建代理名称或计算机名称)
->我正在使用 TFS2010 api,我需要知道每个构建的代理是什么
I have a IBuildDetail variable with the build information I need.
Okay, but when I check the property BuildAgent it's showing this: build.BuildAgent' threw an exception of type 'System.NotImplementedException
Then I tryed to check build.BuildController.Agents, it's nice I found the BuildAgent, but there are 7 build agents in this collection. I need only the build agent related to my build, not all build agents from that controller.
Anyone knows how to get that information? (Select a build agent name or machine name using an IBuildDetail variable)
-> I'm using TFS2010 api and I need to what is the agent for each build
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
构建完成后,您应该能够从 IBuildDetail 的 Information (IBuildInformation) 属性获取代理信息。您可以尝试获取具有以下类型的节点:
http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.build.common.informationtypes.agentscopeactivitytracking.aspx
和字段:
http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.build .common.informationfields.reservedagentname.aspx
或
http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.build.common.informationfields.reservedagenturi.aspx
When the build finishes you should be able to get the agent information from the Information (IBuildInformation) property of IBuildDetail. You can try getting the node with the following type:
http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.build.common.informationtypes.agentscopeactivitytracking.aspx
and fields:
http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.build.common.informationfields.reservedagentname.aspx
or
http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.build.common.informationfields.reservedagenturi.aspx
正如 Duat 所说。
为了回答这个问题,我有机会探索这一点。
以下内容适用于给定的
IBuildDetail buildDetail
&访问IBuildServer buildService
:It's like Duat says.
In order to answer this question, I had the chance to explore this.
The following worked for a given
IBuildDetail buildDetail
& access to aIBuildServer buildService
:在 Run On Agent 范围内,您需要有一个 GetBuildAgent 活动,该活动将 BuildAgent 详细信息分配给 IBuildAgent 类型的变量。
然后,您可以访问该变量的属性,以访问有关构建代理的数据:http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.build.client.ibuildagent.aspx
注意:默认构建工作流程已执行此操作。
Inside the Run On Agent scope you need to have a GetBuildAgent activity that assigns the BuildAgent details to a variable of type IBuildAgent.
You can then access the properties of that variable to get access to data about the Build Agent: http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.build.client.ibuildagent.aspx
Note: The default build workflow does this already.