Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PackageReference conflict resolution craziness

See original GitHub issue

I’m seeing issues with package versioning of transient packages using the PackageReference model. I found this entry in the build log, and this seems like a bug to me. A nuget package requires version 4.3.3, but then dotnet SDK grabs because it’s greater than That doesn’t make sense to me.

Is it a bug?

1>  C:\Program Files\dotnet\sdk\2.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ConflictResolution.targets(41,5): message 

NETSDK1041: Encountered conflict between 'Platform:System.Net.Http.dll' and 'CopyLocal:C:\Users\Joshua\.nuget\packages\\4.3.3\lib\net46\System.Net.Http.dll'.  

NETSDK1033: Choosing 'Platform:System.Net.Http.dll' because AssemblyVersion '' is greater than ''.

If I go to that first folder and look at both the file and product versions, they are 4.6.25707.1.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

dsplaistedcommented, Jan 7, 2019

Messages in the log file about assembly version conflicts don’t generally mean there’s a problem. More or less, it simply means that there are references to different versions of the same library, and it needs to choose the best one.

Trying to understand what is happening can be further confused because there are a bunch of different version numbers a library can have. The NuGet package version, assembly version, and file version can be (and in some cases are) all different.

If you can enable automatic binding redirects in your projects, you should generally not have to worry about all of this. Automatic binding redirects aren’t supported for classic ASP.NET projects, so you may need to add a bunch of binding redirects to your web.config explicitly (which VS will do for you if you double-click the right warning in the error list).

Alternatively, if you are able to target .NET 4.7.2 or higher, I believe that most or all of these conflicts (and hence binding redirects) should go away.

FYI @joperezr in case you have more to add.

MattLavalleeMAcommented, Jan 8, 2019

@dsplaisted IIRC, with a downlevel target framework (i.e., 4.6.2), build won’t copy the transient dependency and you get a runtime error on deployment. In a large solution environment with broadly-shared dependencies, it’s non-trivial to upgrade the target framework of a given library.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NuGet Package Dependency Resolution
With packages.config , NuGet attempts to resolve dependency conflicts during the installation of each individual package.
Read more >
Found conflicts between System.Net.Http
Migrate NuGet from packages.config to PackageReference as per the ... They just put it there to turn us crazy [citation needed].
Read more >
Resolving Nuget dependency conflicts in Project SDK ...
Enter SDK style projects and PackageReference. PackageReference allows you to specify only a top level dependency, and all the transitive ...
Read more >
How to resolve .NET reference and NuGet package version ...
If possible, resolve to a single reference version. The best solution is to remove the need for different reference versions.
Read more >
NuGet PackageReference Versions SOLUTION Wide - YouTube
Having NuGet Packages across multiple projects can be a challenge. Each PackageRefence across csproj files must specify the same version of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found