第三方组件引用类库与项目引用类库不一致

新手上路,请多包涵

最近项目开发要使用消息推送功能,选用的是第三方的极光推送,在使用极光推送的dll时,发现极光使用的newsoft.json是4.5版本,而我们项目使用的是8.0版本。
不知道大家有没有过类似这种第三方引用库版本和自己项目引用库版本不一致的情况,大家有什么好的解决办法吗?

阅读 3.5k
1 个回答

七牛云存储的sdk也是这样。我的解决方案是
使用nuget删除sdk带的版本,然后找到引用了该sdk的项目,找到web.config(或者app.config),将里面的

<dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" />
      </dependentAssembly>

修改成

<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>
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进