AVG
AVG

Reputation: 61

connection Azure DevOps using REST API

I am trying to connect Azure DevOps in .net core application with following code.

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. But still this error occurs.

Could you please let me know how to resolve this? thanks

Upvotes: 1

Views: 824

Answers (1)

Brandon McClure
Brandon McClure

Reputation: 1410

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:

 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.

There is no .net core support ATM from my understanding. A coworker of mine commented on this open issue with some more context of how we made this work.

Upvotes: 1

Related Questions