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