我已经编写了下面的代码来通过 api 对构建进行排队。团队项目集合、工作项存储和版本控制服务器工作正常,但我没有得到 buildserver 对象。它总是返回null。我是否缺少任何其他配置
using (TfsTeamProjectCollection tpc = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://tfsserver:8080/tfs/DefaultCollection")))
{
tpc.EnsureAuthenticated();
// i am getting workitemstore object here
var wiStore = tpc.GetService<WorkItemStore>();
....
....
// i am getting version control server object here as well
var vcs = tpc.GetService<VersionControlServer>();
....
....
// but here i get a null object
var bs = tpc.GetService<IBuildServer>();
//this is what i want to do with buildserver object
var buildDefinition = bs.GetBuildDefinition("aaa", "bbb");
var buildRequest = buildDefinition.CreateBuildRequest();
bs.QueueBuild(buildRequest);
}
任何想法?