最近在项目上使用 Ozeki SDK 的时候遇到版本冲突的问题,冲突库是 Newtonsoft.Json ,主要因为 Ozeki SDK 把 Newtonsoft.Json 1.0.x 嵌入了,而我的项目里引用的是 Newtonsoft.Json 11.0.2 ,在使用相关对象时编译器报错:
The type 'JsonConvert' exists in both 'XXX.XXX, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=...' and 'Newtonsoft.Json, Version
=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
然后 Baidu 了下,搜到的解决办法竟然是在 App.config 中添加类似以下一段代码
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
&l