我正在尝试使用 SocketIO4Net在 .net 中创建 socket.io 客户端。似乎 SocketIO4Net 依赖于 Newtonsoft.Json >= 4.0.8。我也在用 PushSharp具有 >= 4.5.10 的 Newtonsoft.Json 依赖项的库。当我第一次安装 PushSharp 时,我得到了 NewtonSoft.Json 4.5.11,我认为这个版本也应该支持 SocketIO4Net,因为它是一个更高的版本,但是每当我尝试连接到 socket.io 服务器时,我都会收到这个错误。
Could not load file or assembly 'Newtonsoft.Json, Version=4.0.8.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
我整天都在为这些依赖性问题而苦恼,如果有人能指出正确的方向,我将不胜感激。
最佳答案
找到解决方案,尝试:
<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"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
关于c# - Newtonsoft.json 程序集包版本不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17236342/