从构建获取BuildAgent信息信息、BuildAgent

2023-09-06 06:43:19 作者:掩埋于尘埃的痛心

我有一个IBuildDetail变量,我需要的版本信息。

I have a IBuildDetail variable with the build information I need.

好了,但是当我检查的属性BuildAgent它显示的:build.BuildAgent引发了异常类型的System.NotImplementedException

Okay, but when I check the property BuildAgent it's showing this: build.BuildAgent' threw an exception of type 'System.NotImplementedException

然后我trye​​d检查build.BuildController.Agents,很高兴我找到了BuildAgent,但也有在此集合7生成代理。我只需要生成代理与我的身材,并不是所有从控制器建立代理。

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.

任何人都知道如何得到这些信息? (使用IBuildDetail变量选择的生成代理的名称或计算机名称)

Anyone knows how to get that information? (Select a build agent name or machine name using an IBuildDetail variable)

- >我使用TFS2010 API,我需要的是为每个构建代理的

推荐答案

这就像Duat说。要回答的这个的问题,我有机会去探索这个以下工作对于一个给定 IBuildDetail buildDetail &放大器。访问 IBuildServer编译服务

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 a IBuildServer buildService:

IBuildInformation buildInformation = buildDetail.Information;
IBuildInformationNode[] buildInformationNodes = buildInformation.Nodes;
string agentUri = buildInformationNodes[0].Children.Nodes[3].Fields["ReservedAgentUri"];
IBuildAgent buildAgent = buildService.GetBuildAgent(new Uri(agentUri));