c# - 是否有可能解决这种装配不匹配的情况?或者这是无法解决的?
问题描述
在我的程序集中我想使用
SomeLibrary.dll
->Newtonsoft.Json, Version 10.0.0.0
我SomeLibrary.dll
通过路径引用的地方。然后我也有
Microsoft.NET.Sdk.Functions
->Newtonsoft.Json, Version 9.0.0.1
Nuget 都引用了这些内容。当我这样做时,这会导致版本不匹配
JsonConvert.DeserializeObject<SomeTypeFromSomeLibrary>(json)
我能做些什么吗?:(
解决方案
这种问题通常通过绑定重定向来解决。
对于 JSON.NET,它可能看起来像这样:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
推荐阅读
- ios-app-group - 在 WidgetKit 的应用程序组上存储一个数组
- laravel - Laravel Vue js 编辑模式:将值从字段传递到变量
- sql - 如何在使用 Union 时模拟 ON 条件?
- asp.net-mvc - How to fix RazorEngine issue with Html.HiddenFor
- flutter - 转换后的 JSON 在 listView 中不显示任何内容
- gitlab - Gitlab CI SAST 在后续阶段访问 gl-sast-report.json 工件
- linux - 仅将当前目录中的文件添加到 .7z 文件中,而不使用递归目录
- angular - 与 ng-template 一起使用时不会触发 mat-button 单击
- sql - 如何使用 SQL 查询将单个列值拆分为多个列,并将值作为列名
- javascript - 需要帮助创建带标题的幻灯片索引