[c#] Could not load file or assembly 'System.Net.Http.Formatting' or one of its dependencies. The system cannot find the path specified
Remove all code references to
in the package window,
Clean and rebuild your project
I have a small MVC app that I use for practice reasons, but now I am encountering an error every time I try to debug:
Could not load file or assembly 'System.Net.Http.Formatting' or one of its dependencies. The system cannot find the path specified.
I've googled but cannot find a solution. I'm using .NET 4.5.
It can't be the DLL file because I'm using .Net 4.5.
As originally suggested in a comment by GeoMac and documented on NuGet's docs the following worked for me when none of the other answers worked:
Tools / NuGet Package Manager / Package Manager Console
Update-Package -ProjectName MyProjectName -reinstall
What solved this annoying error for me was just to close Visual Studio and open it again. Then rebuild the solution, and it all worked again. Sorry for the crap answer, but I think it's worth an answer because it solved it for me.
In my case, none of the above worked, however, replacing 220.127.116.11 with 18.104.22.168 did solve the problem.
In my case none of the above solutions worked. I solved by right clicking on the reference
from Visual studio and setting the property Copy Local to true.
I hope this is useful somehow.
Removing the following lines from
web.config solved my problem. Note that in this project I didn't use WebApi components. So for others this solution may not work as expected.
<dependentAssembly> <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-22.214.171.124" newVersion="126.96.36.199" /> </dependentAssembly>