简体   繁体   English

使用 REST API 连接 Azure DevOps

[英]connection Azure DevOps using REST API

I am trying to connect Azure DevOps in .net core application with following code.我正在尝试使用以下代码连接 .net 核心应用程序中的 Azure DevOps。

var url = new Uri("https://abcdxyz.visualstudio.com");

var PAT = "XXXXXgdeuxfroaqho4lhtqjdvbagrotypfgfhtuq6w23ie5z3xoq";

VssConnection connection = new VssConnection(url, new VssBasicCredential(string.Empty, PAT));
WorkItemTrackingHttpClient witClient = connection.GetClient<WorkItemTrackingHttpClient>();

it builds successfully.它成功构建。 However, it throws error as但是,它会抛出错误

System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Net.Http.WebRequest, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.'

I tried to update Nuget package.我试图更新 Nuget 包。 But still this error occurs.但是还是会出现这个错误。

Could you please let me know how to resolve this?你能告诉我如何解决这个问题吗? thanks谢谢

I recall having a similar issue, and this is the way we get the WIT client in our .net core app that uses these libraries:我记得有一个类似的问题,这是我们在使用这些库的 .net 核心应用程序中获取 WIT 客户端的方式:

 vss = new VssBasicCredential(string.Empty, PAT);
 VssConnection connection = new VssConnection(tfsURI, vss);
 witClient = connection.GetClient<WorkItemTrackingHttpClient>();

 workItemClient = new WorkItemClient(witClient);

We are using the preview versions of the Microsoft.TeamFoundationServer.Client and Microsoft.VisualStudio.Services.Client libraries as well.我们也在使用Microsoft.TeamFoundationServer.ClientMicrosoft.VisualStudio.Services.Client库的预览版。

There is no .net core support ATM from my understanding.据我所知,没有 .net core 支持 ATM。 A coworker of mine commented on this open issue with some more context of how we made this work.我的一位同事评论了这个悬而未决的问题,并提供了更多关于我们如何进行这项工作的背景。

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

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