Closed oscarsan closed 8 years ago
I actually discover the problem at the same time that was writing the issue, when installing the package it will actually install latest Newton.Json version which is 8.0.x, this will not work. You need to install first the Newton.Json version 6.0.1 (Haven't test anything newer) and then install this package, any idea what has change in the newer Newton.Json that generates this problem?
Yeah. This is a problem with Newtonsoft.Json's strategy to strong-name the assembly and occasionally bump the major version.
First of all, we should probably ship a newer version of this package soon, it'll probably be in the 2.0 timeframe. That's right around the corner.
Before that, I think you should be able to solve this by using some assembly binding redirects:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Try adding the xml above to your app.config :smile:
Ok, when i write that in the app.config I can use latest version of Json.net.
Thanks
I have same problem on windows service project and Newtonsoft.Json 11 . I test the cli and run without problem but I got dependency exactly like you when I move code to windows service wrapper. I try your xml with json.net version 8.1 and 7.1 but both of them made same problem.
I'm trying to use the JsonNet package but it is not working with self hosted Nancy. I think I'm doing everything as needed, installing the package from Visual Studio will result in versions
Code is very basic
For running nancy and small bootstrapper and custom serializer
This is the exception message
An unhandled exception of type 'System.InvalidOperationException' occurred in Nancy.dll
Additional information: Something went wrong when trying to satisfy one of the dependencies during composition, make sure that you've registered all new dependencies in the container and inspect the innerexception for more details.
And further Innerexception
{"Unable to resolve type: Nancy.NancyEngine"} {"Unable to resolve type: Nancy.Routing.DefaultRequestDispatcher"} {"Unable to resolve type: Nancy.Routing.DefaultRouteResolver"} {"Unable to resolve type: Nancy.Routing.DefaultNancyModuleBuilder"} {"Unable to resolve type: Nancy.DefaultResponseFormatterFactory"} {"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)":"Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed"}