1

I'm using a NuGet package (IdentityModel.OidcClient 3.1.2) and this throws an error

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

The version in the bin folder is Newtonsoft.Json.dll v11.0.2.xx

So I probably need a binding redirect for the underlying package Newtonsoft.Json.dll, but where do I put that redirect? Tried AutoGenerateBindingRedirects=true but that didn;t solve it.

gjvdkamp
  • 9,929
  • 3
  • 38
  • 46
  • What kind of project is that? This is a web application, console? .net core or .net framework? Usually you have to add binding redirects in your web.config/app.config file. https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions – Peska Apr 07 '20 at 18:17
  • .Net Framework 4.7.1 that runs as an add-in into Excel. When I run the code outside Excel it does work. It's one of those.. – gjvdkamp Apr 08 '20 at 06:10
  • How about something like this: https://stackoverflow.com/q/25664372/7225096 – Peska Apr 08 '20 at 09:38

0 Answers0