Getting Error as Could not load file or assembly 'Newtonsoft.Json

0

I installed some frameworks

Microsoft.Owin.Host.SystemWeb
Microsoft.Owin.Security.OAuth
Microsoft.Owin.Cors

After adding these, I'm getting the following error:

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

Please guide me as to how I can overcome this issue.

c#
visual-studio-2015
asked on Stack Overflow Dec 17, 2018 by ems ems • edited Dec 17, 2018 by Kjartan

2 Answers

1

I came a cross this issue for some years ago and the little bastard that is creating the issue is the Microsoft.Owin.Security.OAuth.

For some reason, if no newtonsoft package is installed when installing the Owin.Security.OAuth it will install it's required version but don't automatic upgrade it's reference to a newer if you install a newer newtonsoft package.

To solve it, first, uninstall the newtonsoft package

uninstall-package Newtonsoft.Json -Force

Then reinstall it

install-package Newtonsoft.Json

Then finally, update the Microsoft.Owin.Security.OAuth package

update-package Microsoft.Owin.Security.OAuth
answered on Stack Overflow Dec 17, 2018 by Marcus Höglund
0

via NuGet type this:

Install-Package Newtonsoft.Json -Version 10.0.2

More details here Newtonsoft.Json

answered on Stack Overflow Dec 17, 2018 by bat7

User contributions licensed under CC BY-SA 3.0