覆盖自动基因重定向结合.NET框架
我在构建解决方案时看到了此警告 -
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而不是4.2.0.0的不同版本,我在app.config文件中明确提到了。但是,由于自动构成式标志,它将其重定向到4.2.0.0。 [当我使用4.2.0.0版本时,我在创建HTTPClient时会获得运行时异常。版本4.1.1.3可以正常工作。错误消息:无法加载文件或汇编'system.net.http,版本= 4.2.0.0,culture =中性,publicKeyToken = b03f5f7f11d50a3a'或其依赖关系之一
。 .2
Q1。是否有任何方法可以覆盖通过自动化的重定向重定向(作为app.config结合重定向不起作用)?如果是,怎么样?
Q2。 AutogenerateBindingRects Flag如何决定要重定向哪个版本? (就像为什么System.net.http被重定向到4.2.0.0没有其他任何版本)
预先感谢!
I am seeing this warning while building my solution -
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" />"
I have to use different version of System.Net.Http version 4.1.1.3 not 4.2.0.0 which I've explicitly mentioned in the App.config file. But due to AutoGenerateBindingRedirects flag, it's redirecting it to 4.2.0.0. [When I use 4.2.0.0 version, I am getting Runtime Exception while createing HttpClient. It works fine with version 4.1.1.3. Error-Message : Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies
.]
.Net framework - 4.6.2
Q1. Is there any way to override the binding redirects which got generated via AutoGenerateBindingRedirects (as App.Config binding redirects are not working)? If yes, How?
Q2. How does AutoGenerateBindingRedirects flag decide which version a particular assembly has to redirect ? (like why System.Net.Http is being redirected to 4.2.0.0 not any other version)
Thanks in advance!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论