Box API .dll is not requesting the correct version of Newtonsoft.Json

0

So to complete the title, more specifically one of the dependencies of the box.v2 API is not requesting the correct version of Newtonsoft.Json.

All of the dependencies of the API is:

  • Newtonsoft.Json (>= 10.0.3)
  • System.IdentityModel.Tokens.Jwt (>= 5.1.4)
  • BouncyCastle (>= 1.8.1)

The item that is throwing the exception is:

  • The type initializer for 'System.IdentityModel.Tokens.Jwt.JsonExtensions' threw an exception.

The error is:

Could not load file or assembly 'Newtonsoft.Json, Version=9.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)

I am about 110% lost at this point. I have tried everything in my power with no luck. To give a little bit of background and reference to everything that I have tried:

  1. I have a console app that the code is originally built-in on the same server utilizing the same NuGet package. This app works just fine.
  2. I have tried removing the NuGet package and just adding the .dll's manually and referencing them, this threw the same error.
  3. I have made sure that the App.Config file has redirects for all lower versions of the package to the new version of Newtonsoft.

The code line that is throwing this error is here, it breaks on the session call (var client):

var session = new BoxJWTAuth(BoxConfig.CreateFromJsonFile(fs)); //create a service account session object using the jwt
var client = session.AdminClient(session.AdminToken(), userId);  //start the session call

References to other solutions I have tried to no avail (just to avoid repetition).
The located assemblys manifest definition does not match the assembly reference The located assemblys manifest definition with name xxx dll does not match the assembly reference JWT unable to decode the header as base64url encoded string How to use app config in visual studio c net

c#
.net
dll
dependencies
asked on Stack Overflow Nov 1, 2019 by Wesley Blackwell • edited Nov 2, 2019 by MasLoo

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0