Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load assembly in NUnit

Seems like this should be a common problem that I expected to find an answer to via a quick Google search, but alas I cannot seem to find the answer.

I am writing a Unit Test using NUnit in C# for a method that relies on a third party library, Newtonsoft.Json to be specific.

When I attempt to call that method from my unit test I receive the all to common

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.

Both the unit test and the application are using the exact same newtonsoft library and the dll is set to copy local in both projects.

Seems like I am missing something super obvious but I can't seem to overcome this issue.

like image 929
pat8719 Avatar asked Nov 13 '13 19:11

pat8719


1 Answers

"The located assembly's manifest definition does not match the assembly reference" Indicates that it can find the DLL, but there is a version mismatch between the assembly and what's in your project's manifest. Can you verify in windows explorer that the DLL's version really is 4.5.0.0?

I'd also be curious to see if there's more than one version of this assembly in your GAC -- perhaps NUnit is defaulting to a different version.

like image 174
Reacher Gilt Avatar answered Nov 07 '22 23:11

Reacher Gilt