Whenever I call a method that creates new HttpClient(), i get and exception. No clue, as System.Net.Http is already referenced.
public async Task<Stuff> GetOrder(int id)
{
var t = new HttpClient();
}
"InnerException": { "ClassName": "System.IO.FileNotFoundException", "Message": "Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.",
Any ideas?
The issue was caused by:
Microsoft.Extensions.Configuration.Abstractions
Whenever I had a reference to this assembly, it would throw this error. I needed this as I was using API config stuff. So the fix was to NOT let Resharper add reference to Http.Net but to have HttpClient referenced by NuGet.
<package id="System.Net.Http" version="4.3.3" targetFramework="net461" />