0

In Visual Studio 2015, I have Project A (Web Api Application) and Project B (MVC Application) in the same solution.

I can debug application A and application B separately. But, When application B calls rest api from A, I receive dll dependency error from application A.

"Could not load file or assembly 'Newtonsoft.Json' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference".

When I clean build project A, at the first time call is successful, however subsequent calls receive same error.

How can I fix this?

(I use IIS 7.5)

Ahmet Altun
  • 3,910
  • 9
  • 39
  • 64

1 Answers1

0

To solve this, please mark sure that your two projects used the same Newtonsoft.Json version.

You can run the following command:

update-package Newtonsoft.Json -reinstall

Please also view your web.config, maybe you could remove the old version like:

 <dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />   </dependentAssembly>

Generally if we want to ensure all Newtonsoft.Json packages are the same version, we also can specify the version:

update-package Newtonsoft.Json -version 6.0.0 -reinstall

Reference:

Could not load file or assembly 'Newtonsoft.Json, Version=7.0.0.0

http://blog.myget.org/post/2014/11/27/Could-not-load-file-or-assembly-NuGet-Assembly-Redirects.aspx

Jack Zhai
  • 6,230
  • 1
  • 12
  • 20