【问题标题】:System.Net.Http, Version=4.2.0.0 conflictSystem.Net.Http,版本=4.2.0.0 冲突
【发布时间】:2021-03-22 20:29:44
【问题描述】:

C#编译错误

如果您在运行时遇到 System.net.http 错误,说明“无法加载文件或程序集 'System.Net.Http,版本 = 4.2.0.0”。类似的东西

System.IO.FileNotFoundException:无法加载文件或程序集“System.Net.Http,版本=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 或其依赖项之一。该系统找不到指定的文件。 ---> System.IO.FileNotFoundException:无法加载文件或程序集“System.Net.Http,版本=4.0.0.0,文化=中性,PublicKeyToken=b03f5f7f11d50a3a”或其依赖项之一。系统找不到指定的文件。警告:程序集绑定记录已关闭。 要启用程序集绑定失败日志记录,请将注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) 设置为 1。 注意:有一些与程序集绑定失败日志相关的性能损失。 要关闭此功能,请删除注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog]

【问题讨论】:

    标签: file load


    【解决方案1】:

    对我来说,我有不同的包使用不同的版本。当一个包将 'bindingRedirect' 添加到 app.config 文件时,它就开始了。 删除 bindingRedirect 后问题解决 bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" 来自 app.config 文件。 所以删除如下条目 <dependentAssembly> <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" /> </dependentAssembly>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-24
      • 1970-01-01
      • 2018-07-01
      • 2019-08-07
      • 1970-01-01
      相关资源
      最近更新 更多