I have several projects in my VS solution. Whenever I add \"System.Net.Http\" NuGet package to one it shows as version 4.2.0.0. Then I do the same and add same NuGet Package
After going through all the solutions presented here and the references cited in this answer, I finally resolved this completely. This is what I believe anyone who experiences this issue should do:
System.Net.Http
that are not managed by NuGet (for projects using PackageReference, you should see the NuGet symbol next to the reference in Solution Explorer). Replace the removed System.Net.Http
references with the corresponding NuGet package if you're certain your project requires System.Net.Http
(try building without it first). For projects using packages.config, take extra care to ensure that references to System.Net.Http
are required and that they are also using NuGet. It may help to remove and re-add System.Net.Http
via NuGet anyway (for all projects referencing it), even if already referenced using NuGet. I found that step 2 can cause some disjoint somewhere.If you later find that you get run-time exceptions (even during unit testing) due to manifest mismatches after adding a reference somewhere, remove all the binding redirects from the website project concerned, then re-add the suggested ones given in the warning as per step 6.
I spent a lot of time trying to resolve this issue methodically, so I believe the above steps would fully resolve most people's issues, although some lateral thinking might be required for unusual cases. Let me know if this works (or doesn't work) for you.