3

So I started working on an existing project at work in NopCommerence and I accidently added the Newtonsoft.Json DLL to the Nop.Core project, ever since then, the project keeps randomly crashing giving me the error:

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

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

enter image description here

I removed the reference from the project right away, so there is now no reference to this DLL in the Nop.Core project.

But there is some code in the project which looks for the reference:

enter image description here

When we get to that plugin it crashes here:

enter image description here

I got no clue where to even look to solve this, it looks like it's trying to load two different versions of the DLL and when I Google around, it says to update though NuGet and I did this and nothing has solved it.

Ross Ridge
  • 38,414
  • 7
  • 81
  • 112
Jessica
  • 115
  • 1
  • 8
  • Remove `{Newtonsoft.Json.dll}` from `pluginFiles` prior to `foreach` – Filip Bulovic Jun 27 '15 at 00:36
  • I don't want to just remove it from the list, because I don't know if it is being used else where, it's having problems in the plugins, which is used across the entire project – Jessica Jun 27 '15 at 00:53
  • try to update Newtonsoft.Json.dll from nuget and update it in whole solution so it will update in all plugin and application so there are no different version files in different plugin and application, by this your problem resolved... – Vinit Patel Jun 27 '15 at 04:43
  • Tried updating it and no luck – Jessica Jun 27 '15 at 16:15

1 Answers1

0

So you removed the reference, but what about the actual dll file? It looks like something is 'discovering' it at runtime and it exists on your disk somewhere and the application is finding it.

It's hard to know what to suggest but try to find out where the app is looking for plugin files, then look in that directory and delete the Json stuff. You could also try just deleting all of the bin and obj directories in the whole solution, since they will be re-created by the next build. Also look in the packages directory in the root of your solution, you may find a copy of the Json package lingering there. If you;ve definitely removed it using NuGet, then delete it from packages too.

Make a backup copy before you start, just in case my suggestions are complete rubbish ;-)

Tim Long
  • 13,508
  • 19
  • 79
  • 147