What object returns from TFS2015 RestAPI

后端 未结 2 722
南旧
南旧 2021-01-29 04:20

I\'m using TFS 2015 rest api in order to retrieve build definitions and builds details using those calls:

definitions: http:///tfs/DefaultCollection//_apis/build/definit

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-29 05:24

    You could use install this Nuget package for your project and in the package. The assemblies in this package has already help you transfer the json data to the corresponding object. For example, to get something about build, you could use the Microsoft.TeamFoundation.Build.WebApi assembly. To get a build definition:

    var u = new Uri("http://serverName:8080/tfs/MyCollection/");
    VssCredentials c = new VssCredentials(new Microsoft.VisualStudio.Services.Common.WindowsCredential(new NetworkCredential("userName", "password", "domain")));
    var connection = new VssConnection(u, c);
    var buildServer = connection.GetClient();            
    BuildDefinition builddef = buildServer.GetDefinitionAsync("AgileMttGreen",10).Result;
    Console.WriteLine(builddef.Name);
    

提交回复
热议问题