refit icon indicating copy to clipboard operation
refit copied to clipboard

Consider removing reference to `System.Net.Http` NuGet package

Open OronDF343 opened this issue 2 years ago • 1 comments

I'm considering using Refit in an environment with both .NET 6.0 and legacy .NET Framework services. However, I noticed that Refit has a reference to System.Net.Http 4.3.4. Transitive references to this package in .NET Framework projects have caused us major headaches in the past. The official recommendation is to avoid referencing the package.

While most issues are not present in .NET Framework 4.7.2 and SDK-style projects, this is not always the case with older projects. For example, in Web Site projects, the outdated version of System.Net.Http as well as outdated version of many other runtime libraries such as System.IO are copied to the Bin folder by default. This can and will break user code that depends on .NET Framework 4.7.2 behavior, such as HttpClientHandler.SslProtocols, which throws an exception in the older versions.

As for why Refit references it in the first place, I found this issue but it seems to be unrelated to the functioning of Refit, instead having to do with some broken build system.

Please consider removing the reference.

OronDF343 avatar Aug 08 '23 14:08 OronDF343

Any update on this one? I'm facing issues with Refit and other involved projects because of this dependency

adcorduneanu avatar Aug 12 '24 19:08 adcorduneanu

System.Net.Http.Json has been removed from non .NetFramework and .NetStandard versions as a first step, I will check the reason for the System.Net.Http reference being there

ChrisPulman avatar Sep 20 '24 00:09 ChrisPulman

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Oct 05 '24 00:10 github-actions[bot]