Newtonsoft.Json 4.5.0.0 Dependency


#1

Hi guys. I started integrating Hangfire into our app and it seems like others before me I have also come across the issue with Hangfire.Core depending on Newtonsoft.Json 4.5.0.0 for some reason.

I get the error:
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)

at Hangfire.Common.JobHelper.ToJson(Object value)

I naturally tried making sure I have an assembly redirect with:



But that doesn’t seem to be having any effect.

When I look at Hangfire.Core dependencies for .NET Framework 4.5 it says Newtonsoft.Json >= 5.0.1 but clearly that’s not the case as it’s looking for 4.5.0.0. In any case, I would expect the redirect SHOULD work, but for some reason is not. The configuration section doesn’t have a namespace so that can’t be the issue either.

Really running out of ideas and what’s causing this in the first place anyways… pls assist.


#2

Worked it out. Issue was that Newtonsoft.Json 12.0.1 was reporting as 12.0.0 so needed to redirect to 12.0.0.0 and it all worked.