-
Notifications
You must be signed in to change notification settings - Fork 731
Description
Description
The net72 TargetFramework build of FluentAssertions in your NuGet package distribution is broken. The nuspec states this dependency:
<dependency id="System.Net.Http" version="4.3.4" exclude="Build,Analyzers" />This dependency produces a System.Net.Http reference with assembly version 4.1.1.3:

Yet your FluentAssertions assembly itself references a higher assembly version of 4.2.0.0 for System.Net.Http:

This causes some consuming MSBuild projects to fail at the compiler with this error:
CSC : error CS1705: Assembly 'FluentAssertions' with identity 'FluentAssertions, Version=6.8.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a' uses 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Net.Http' with identity 'System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
In fact no System.Net.Http package version offers an assembly version of 4.2.0.0. This leaves two options for fixing:
Option 1
Actually compile against the System.Net.Http that your nuspec documents, giving your assembly reference a 4.1.1.3 assembly version instead of 4.2.0.0. This would remove the conflict in the compiler and resolve the error for your users.
Option 2
Because the 4.2.0.0 assembly version comes from the .NET Framework targeting pack rather than nuget, remove the System.Net.Http nuget package reference from your net47 build and instead add a frameworkAssemblies reference to your nuspec:
<dependencies>
<group targetFramework=".NETFramework4.7">
- <dependency id="System.Net.Http" version="4.3.4" exclude="Build,Analyzers" />
<dependency id="System.Threading.Tasks.Extensions" version="4.5.0" exclude="Build,Analyzers" />
</group>
...
<frameworkAssemblies>
<frameworkAssembly assemblyName="System.Configuration" targetFramework=".NETFramework4.7" />
<frameworkAssembly assemblyName="System.Data" targetFramework=".NETFramework4.7" />
<frameworkAssembly assemblyName="System.Xml" targetFramework=".NETFramework4.7" />
<frameworkAssembly assemblyName="System.Xml.Linq" targetFramework=".NETFramework4.7" />
+ <frameworkAssembly assemblyName="System.Net.Http" targetFramework=".NETFramework4.7" />
</frameworkAssemblies>Reproduction Steps
Unfortunately all the repro cases I have are in internal projects, and I haven't been able to repro on a File-> New Project to share with you.
I'm hoping that you can see from the Description how this is (at least arguably) faulty though and how the fix should hopefully be straightforward. We have a lot of projects that use FluentAssertions and working around this bug is quite tedious.
Expected behavior
The references that are produced by the nuget package in our consuming projects should match or exceed the assembly references in FluentAssertions.dll.
Actual behavior
some consuming MSBuild projects to fail at the compiler with this error:
CSC : error CS1705: Assembly 'FluentAssertions' with identity 'FluentAssertions, Version=6.8.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a' uses 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Net.Http' with identity 'System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response