dotnet / extensions

This repository contains a suite of libraries that provide facilities commonly needed when creating production-ready applications.
MIT License
2.55k stars 731 forks source link

System.Net.Http reference #5164

Closed galakt closed 1 month ago

galakt commented 1 month ago

In R9 repository there are only PackageReference Include="System.Net.Http" In dotnet/extensions repository there is only Reference Include="System.Net.Http"

I have tried to add Microsoft.Extensions.Http.Resilience package reference to internal R9 project and got compilation error in sample project (project consumes R9 nuget packages and demonstrates common use cases):

error MSB3277: Found conflicts between different versions of "System.Net.Http" that could not be resolved.
error MSB3277: There was a conflict between "System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
error MSB3277: "System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not..

After that I had replaced reference with obsolete resilience package from R9 (..\Obsolete\HttpClient.Resilience\HttpClient.Resilience.csproj) and everything worked as expected.

Questions:

  1. What is intention behind different choices (PackageReference vs Reference) for System.Net.Http?
  2. I believe sample project can be fixed with binding redirects or any other way, but it means every partner on net462 should perform the same change. Any idea how to add Microsoft.Extensions.Http.Resilience package reference without compilation error and any additional change on partners side?