c# - Newtonsoft.json 程序集包版本不匹配

标签 c# dependencies nuget json.net socketio4net

我正在尝试使用 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/

相关文章:

c# - 将表达式<Action<T>> 转换为表达式<Func<T>>

powershell - Nuget Powershell : how to add native dependencies? 如何将文件添加到文件夹内的项目?

c# - 在编译时不知道类型的情况下使用 Windsor 解析泛型接口(interface)?

c# - Xamarin Android 支持库 v4(不完整)?

R、车包无法加载

go - 在 golang 中强制传递依赖版本

dependencies - 使用 Yarn 2 使依赖项的依赖项可用

c# - 将 'Xamarin.Forms' 添加到...未将对象引用设置为对象的实例。添加 nuget 包时出现错误

NuGet 依赖项未安装

c# - 哪个 C# double 文字不能完全表示为 double?