Reputation: 10055
My project is using Newtonsoft.Json.dll. I have added the dll as a reference to my project and im using version 8.0.2
Everything works on my pc however when i transfer everything to a new pc along with Newtonsoft.Json.dll i get the error
Could not load file or assembly 'Newtonsoft.Json‚ Version=4.0.3.0‚ Culture=neutral‚ PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
Im not referencing that version anywhere and there is nothing in my app.config specifying this.
Upvotes: 1
Views: 3445
Reputation: 1716
The previous answer will help you to track down the problem. It happens when some referenced library explicitly specified a version of library that it supports. Fortunately, you can override binding in app.config (see example below):
<configuration>
<!--YOUR CONFIG -->
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Upvotes: 3
Reputation: 703
I would check the version of Newtonsoft.Json in the bin directory of the start up project. If Newtonsoft.Json is there and it is the version you are expecting, then you can use Fuslogvw (https://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.110).aspx) to see where the loader is trying to get the 4.0.3.0 version from. That might give you some insight into why the runtime is looking for a different version.
Hope that helps.
Upvotes: 0