覆盖自动生成的重定向绑定.net框架

问题描述 投票:0回答:1

我在构建解决方案时看到此警告 -

 The explicit binding redirect on "System.Net.Http, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" conflicts with an autogenerated
        binding redirect. Consider removing it from the application configuration file or disabling autogenerated binding redirects. The build will replace it with: "<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" xmlns="urn:schemas-microsoft-com:asm.v
       1" />"

我必须使用不同版本的 System.Net.Http 版本 4.1.1.3,而不是我在 App.config 文件中明确提到的 4.2.0.0。但由于 AutoGenerateBindingRedirects 标志,它将其重定向到 4.2.0.0。 [当我使用 4.2.0.0 版本时,我在创建 HttpClient 时遇到运行时异常。它在 4.1.1.3 版本上运行良好。错误消息:

Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies
。]

.Net 框架 - 4.6.2

Q1。有什么方法可以覆盖通过 AutoGenerateBindingRedirects 生成的绑定重定向(因为 App.Config 绑定重定向不起作用)?如果是,怎么办?

Q2。 AutoGenerateBindingRedirects 标志如何决定特定程序集必须重定向哪个版本? (就像为什么 System.Net.Http 被重定向到 4.2.0.0 而不是任何其他版本)

提前致谢!

c# .net .net-assembly assembly-binding-redirect
1个回答
0
投票

我们在 System.Net.http 上面临同样的问题。如果有更新的话可以发一下吗

谢谢 PT

© www.soinside.com 2019 - 2024. All rights reserved.