Question

I am using PushSharp to deliver mobile push messages, it is dependent on Newtonsoft.Json.dll. I have installed Newtonsoft.Json.dll through NuGet as well because I use it for other things too. A few days ago I updated the Newtonsoft.Json.dll to v 6.x through NuGet in VS2012. When I run the project in VS2012 there are no problems, however when I deploy to production, PushSharp throws an exception that Newtonsoft.Json.dll 4.5.x cannot be found. The Newtonsoft.Json.dll requirements for PushSharp according to NuGet Manager in VS2012 is ">= 4.5.x". Why would it work on my development machine without issue? I cant seem to find any reference (GAC or bin) Newtonsoft.Json.dll 4.5 anywhere on my dev PC.

Était-ce utile?

La solution

You might need to add an assembly binding redirect to your configuration file:

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
        <bindingRedirect oldVersion="1.0.0.0-4.5.0.0" newVersion="6.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top