WireMock.Net icon indicating copy to clipboard operation
WireMock.Net copied to clipboard

Build Conflict between System.Net.Http-Package & Framework-Default Assembly

Open smdbiel opened this issue 10 months ago • 4 comments

Context

Net-Framework (4.8.1) Wiremock uses a PackageReference to Nuget Package "System.Net.Http" in Version 4.3.4

System.Net.Http-Package NugetPackage Version: 4.3.4 (Current and newest) Actual Assembly version sinde: 4.1.1.3

System.Net.Http Assembly included in GAC in Net-Framework 4.8 Assembly Version: 4.2.0.0

Describe the bug

Setup:

  • Main Project with implicit GAC/System-Assembly usage (=4.2.0.0)
  • Unit Test Project with WireMock which adds implicit reference to Package 4.3.4 (=4.1.1.3 as actual assembly Version)
  • A Unit Tests exists wich uses and exchanges a type from System.Net.Http with the tested Main Project

Result:

  • Build of Test-project fails because of conflict (CSC: Error CS1705)
  • Implicitly referenced System.Net.Http in Test-Project can't be explicitly upgraded because no NugetPackage-Version exists with a version as high as the Framework-provided version

Expected behavior:

  • Should be possible to build without downgrading the System.Net.Http-Assembly version in den Main Project
  • Is a reference to System.Net.Http-Package necessary when a newer Framework provided Assembly exists in GAC for 4.8?

Other related info

Things that did not work as a workaround:

  • Assembly Redirect/Rebinding
  • Not exposing internal References with PrivateAssets
  • Trying to explicitly add the System-Assembly in Test Project
  • Trying to skip the implicit inclusion of the Package in Test-Project

smdbiel avatar Mar 04 '25 09:03 smdbiel

@smdbiel

Can you please a complete example project which shows this error?

StefH avatar May 02 '25 07:05 StefH

@smdbiel

Can you please a complete example project which shows this error?

StefH avatar Jun 28 '25 15:06 StefH

@smdbiel

Can you please a complete example project which shows this error?

StefH avatar Jul 20 '25 18:07 StefH

@smdbiel

Can you please a complete example project which shows this error?

StefH avatar Oct 05 '25 13:10 StefH