NuGet引用在dev中工作,在生产中失败

时间:2014-02-06 16:00:05

标签: visual-studio json.net nuget-package pushsharp

我使用PushSharp提供移动推送消息,它依赖于Newtonsoft.Json.dll。我也通过NuGet安装了Newtonsoft.Json.dll,因为我也用它来做其他事情。几天前,我在VS2012中通过NuGet将Newtonsoft.Json.dll更新为v 6.x.当我在VS2012中运行项目时没有问题,但是当我部署到生产时,PushSharp抛出了一个异常,即无法找到Newtonsoft.Json.dll 4.5.x.根据VS2012中NuGet Manager的PushSharp的Newtonsoft.Json.dll要求是“> = 4.5.x”。为什么它会在我的开发机器上没有问题?我似乎无法在我的开发PC上找到任何参考(GAC或bin)Newtonsoft.Json.dll 4.5。

1 个答案:

答案 0 :(得分:2)

您可能需要将程序集绑定重定向添加到配置文件中:

<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>