加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

.net – 与Newtonsoft.Json的汇编冲突

发布时间:2020-12-16 19:49:02 所属栏目:百科 来源:网络整理
导读:我需要加载两个版本的汇编Newtonsoft.Json vesion 4.0.8.0和4.5.0.0 现在在我的配置文件中: dependentAssembly assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" / bindingRedirect oldVersion="0.0.0.0-4.0.
我需要加载两个版本的汇编Newtonsoft.Json vesion 4.0.8.0和4.5.0.0
现在在我的配置文件中:
<dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.8.0" newVersion="4.0.8.0" />
</dependentAssembly>

但是我需要老4.0.8.0和4.5.0.0

<dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.8.0" newVersion="4.5.0.0" />
      </dependentAssembly>

我从Package Console安装最后一个版本,但它给我错误:

错误80无法加载文件或程序集“Newtonsoft.Json,Version = 4.5.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed”或其一个依赖项.找到的程序集的清单定义与程序集引用不匹配. (HRESULT的异常:0x80131040)

我今天遇到了这个问题,我在这个 link中找到了解决方案.

基本上更新了Newtonsoft.Json包.并在web.config中注册此程序集

<dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
    <bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="5.0.8"/>
</dependentAssembly>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读