From bb9868f7380bedc5012ad2ed97bf8cb014caac2b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 3 Feb 2023 17:41:21 -0700 Subject: [PATCH] Declare System.Net.Http as a framework dependency Declaring System.Net.Http as a nuget dependency for net47 is problematic for some consuming projects because it offers assembly version 4.1.1.3, whereas the FluentAssertions assembly itself references 4.2.0.0 of that same assembly. This causes the C# compiler to break the build for these projects. The fix is to declare that System.Net.Http comes from an ordinary `Reference` item that is supplied by the target framework (which in fact it should as it does for FluentAssertions itself) instead of from the NuGet package. It is interesting to call out that although this project previously declared `System.Net.Http` as a `PackageReference`, msbuild nevertheless chose to use the targeting framework version instead of the nuget version. This is ... not something I can explain. And many other projects have the same behavior, which is why it typically works for consuming projects. I don't know why exactly, but some projects do _not_ share this behavior, and those that actually use the nuget dependency that was declared here (before this change) would fail to compile. Fixes #2121 --- Src/FluentAssertions/FluentAssertions.csproj | 5 ++++- Tests/Benchmarks/Benchmarks.csproj | 1 + docs/_pages/releases.md | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Src/FluentAssertions/FluentAssertions.csproj b/Src/FluentAssertions/FluentAssertions.csproj index 478d500ba9..ee4c7c1654 100644 --- a/Src/FluentAssertions/FluentAssertions.csproj +++ b/Src/FluentAssertions/FluentAssertions.csproj @@ -91,7 +91,10 @@ - + + $(TargetFramework) + + diff --git a/Tests/Benchmarks/Benchmarks.csproj b/Tests/Benchmarks/Benchmarks.csproj index f6e9a4d63a..9f0c088bf2 100644 --- a/Tests/Benchmarks/Benchmarks.csproj +++ b/Tests/Benchmarks/Benchmarks.csproj @@ -15,5 +15,6 @@ + diff --git a/docs/_pages/releases.md b/docs/_pages/releases.md index f7c6f8ee61..3b295dd80a 100644 --- a/docs/_pages/releases.md +++ b/docs/_pages/releases.md @@ -16,6 +16,8 @@ sidebar: * `BeEquivalentTo` no longer crashes on fields hiding base-class fields - [#1990](https://github.com/fluentassertions/fluentassertions/pull/1990) +* Fixed System.Net.Http dependency declaration for net47 target framework to be a framework dependency instead of a nuget dependency - [#2122](https://github.com/fluentassertions/fluentassertions/pull/2122) + ## 6.9.0 ### What's new