Recently I was working on a Visual Studio Extension which required HttpClient when I ran into the following exception. Frustratingly enough, I wasn’t able to resolve it myself, despite playing around with the versions and using Binding Redirect.
System.IO.FileNotFoundException: ‘Could not load file or assembly ‘System.Net.Http,Version=22.214.171.124, Culture=neutral, ….. The system cannot find the file specified.
The Binding Redirect didn’t quite as it is not possible to use the redirects in VS Extensions. However, the solution turned out to be choosing an alternative for HttpClient as pointed in SOF.
Instead of HttpClient, I had to depend on something which is more native to.Net, like HttpWebRequest. Hope this post is useful to anyone who stumbles on similar issues.