Is there a .NET API equivalent to the “Build 2.0” REST API for TFS 2015?

拜拜、爱过 提交于 2019-12-04 17:54:32

问题


The REST API Reference for VS Team Services and TFS page separates the "Build 1.0" and "Build 2.0" APIs.

It seems like such a difference also exists in the .NET API because running the following code only lists the "old" XAML build definitions and not the new ones.

var tpc = new TfsTeamProjectCollection(new Uri("http://tfsurl"));
var buildServer = tpc.GetService<IBuildServer>();
var def = buildServer.QueryBuildDefinitions("Project Name"); // Finds only XAML definitions

Is there a new DLL I can reference to write equivalent code that will work with the new TFS or is the web API all there is?


回答1:


You're looking for:

 Microsoft.TeamFoundation.Build.WebApi.BuildDefinition

in:

 Microsoft.TeamFoundation.Build2.WebApi, Version=14.0.0.0

Which can be accessed through:

 Microsoft.TeamFoundation.Build.WebApi.BuildHttpClient

Simplest way to add it to your project is using the Nuget Package:

PM> Install-Package Microsoft.TeamFoundationServer.ExtendedClient


来源:https://stackoverflow.com/questions/34500539/is-there-a-net-api-equivalent-to-the-build-2-0-rest-api-for-tfs-2015

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!