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
WebRequestis not natively supported in .NET Core, and this library is usingWebRequest, meaning it was likely designed for .NET Framework. You should try to find an alternate library, or if you cannot not, you should target .NET Framework, instead of .NET Core. You can still use ASP.NET Core, as it will run on either.