2
votes

I have a project A consuming System.Net.Http, Version=4.3.3 and some project Y. (Which does not consume that nuget directly, though both may be consuming them indirectly)

I added nuget X to project A, and begun receiving an error such as this:

error CS1705: Assembly 'Y' with identity 'Y, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' 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.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

I added a package reference of version 4.3.3 of System.Net.Http to both projects A and Y, but that did not make any change. (I am guessing the dependency results from nuget X's dependencies?)

Any ideas what can be the cause and solution to my problem?

2

2 Answers

0
votes

You can follow these steps to consolidate the System.Net.Http version:

  1. In your solution, Right Click and select the "Manage Nuget Packages for Solution...".
  2. Select the "Consolidate" tab.
  3. Select for the "System.Net.Http".
  4. On the right panel section, you will see the Project and its the versions installed.
  5. If you see that there is conflicting version, select the projects you want to have the same version. Then in the "Version" dropdown, select your preferred version.
  6. Click Install and it will manage change the versions of those projects into one version (which you selected).
0
votes

Basically, its a conflict of .Net Core Nuget package and .Net framework package reference. I fixed the same issue by:

  1. Uninstalling the Nuget package for project in which the erroneous file exits.

  2. Adding the reference in project for the same package i.e., System.Net.Http by right click the references,click Add reference and then adding reference.