I'm attempting to parse a JSON file in Class Library within an Web API solution. It is a regular C# Class Library, not the Portable kind.
I've tried every single answer mentioned here, but it still doesn't work! I keep getting the same error which is:
Could not load file or assembly 'Newtonsoft.Json, Version=8.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)":"Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
Here is the code:
public IList<BranchRM> AllBranches()
{
var result = new List<BranchRM>();
var dataSourcePath = AppDomain.CurrentDomain.BaseDirectory + "Data/branches.json";
var dataAsText = File.ReadAllText(dataSourcePath);
if (string.IsNullOrEmpty(dataAsText)) return result;
var branchList = JsonConvert.DeserializeObject<List<Branch>>(dataAsText);
result = AutoMapper.Mapper.Map<List<BranchRM>>(branchList);
return result;
}