简体   繁体   English

团队基础服务器的“客户端”和“WebApi”库之间有什么区别?

[英]What is the difference between team foundation server's “Client” and “WebApi” libraries?

I'm writing C# to interface with TFS to manipulate Work Items in TFS. 我正在编写C#以与TFS接口来操作TFS中的工作项。 The existing code I'm working with is exclusively using Microsoft.TeamFoundation.WorkItemTracking.WebApi but from what I see in examples online, the library everyone is using is Microsoft.TeamFoundation.Client and Microsoft.TeamFoundation.WebApi.Client 我正在使用的现有代码专门使用Microsoft.TeamFoundation.WorkItemTracking.WebApi但是从我在网上的示例中看到的,每个人使用的库是Microsoft.TeamFoundation.ClientMicrosoft.TeamFoundation.WebApi.Client

From what I can infer, the WebApi library is providing only a limited functionality - for instance, I can't create an attachment and associate it to a WorkItem - but, this does appear to be possible with the Client library. 根据我的推断,WebApi库只提供有限的功能 - 例如,我无法创建附件并将其与WorkItem相关联 - 但是,这似乎可以通过客户端库实现。 Before changing a lot of code to do this, I'm really just interested in knowing what's the underlying difference between these libraries. 在更改大量代码之前,我真的只是想知道这些库之间的潜在差异。

Any insight into the TFS client libraries would be much appreciated. 任何对TFS客户端库的深入了解都将非常感激。

The mainly difference is that Client libraries (SOAP API) use Legacy Client Object Model while WebApi libraries calls the New Rest API to achieve the functions. 主要区别在于客户端库(SOAP API)使用旧客户端对象模型,而WebApi库调用New Rest API来实现这些功能。

And the mainly limitation with these two APIs: 这两个API的主要限制是:

  1. Client libraries cannot work well with the new vNext build system. 客户端库无法与新的vNext构建系统一起使用。
  2. WebApi cannot perform update action (For example check in changes) with Version Control, it can only read information for now. WebApi无法使用Version Control执行更新操作(例如,检入更改),它现在只能读取信息。

The WebApi can create an attachment and associate it to a Workitem, you need to updolad the attachment to VSTS by call "CreateAttachmentAsync" method and then call "UpdateWorkItemAsync" method to add the uploaded attachment to a work item. WebApi可以创建附件并将其与Workitem关联,您需要通过调用“CreateAttachmentAsync”方法将附件更新到VSTS,然后调用“UpdateWorkItemAsync”方法将上载的附件添加到工作项。 It is following a same workflow as the Rest API: Upload an attachment and then Add an attachment . 它遵循与Rest API相同的工作流程: 上传附件 ,然后添加附件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM