Nuget Package Conflict in Dependencies


I found that my console app (.NET Core 2.2) was blowing up because there seemed to be some kind of conflict between dependencies for JSON.NET (Newtonsoft).

This was the exception:

System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Upon further investigation, I discovered the cause of the exception, which I will lay out below.

I have a reference to a local Project which depends on JSON.NET. Let's call it SomeDomain. That relies on v12.0.2 of JSON.NET.

I also have installed (by way of Nuget), the package Microsoft.Extensions.Configuration.Json (v2.2.0) which also relies on JSON.NET. If you go to the page for that version of that package, you'll see the version dependancy is >= 11.0.2

I'm thinking "sweet".

Not so.

When I publish, it is resolving v11.0.2 of JSON.NET. And this leads to an exception, because SomeDomain depends on v12.0.2 .

In an attempt to resolve this, I added v12.0.2 of JSON.NET directly to the app. I figured this would force it to use that version. Not so. It still resolves v11.0.2 of JSON.NET upon Publish.

Does anyone know how I can force it to resolve v12.0.2 of JSON.NET when I publish my app?

asked on Stack Overflow Feb 18, 2020 by onefootswill • edited Feb 18, 2020 by marc_s

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0