我想知道为什么 nuget 将以下代码添加到我的应用程序中app.config
文件,安装后Microsoft.Bcl.Async
:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.5.19.0" newVersion="2.5.19.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.5.19.0" newVersion="2.5.19.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
如果我从配置中删除此 XML 元素,应用程序将无法正常工作。
据我了解,我们可以使用bindingRedirect
使应用程序加载较新或较旧版本的程序集,以防我们在编译 EXE 时使用的版本消失。
不过我使用的正是这个版本2.5.19.0
,为什么我需要重定向?
Why我需要这个吗bindingRedirect
?
组件Microsoft.Threading.Tasks
and Microsoft.Threading.Tasks.Extensions
仍然引用 v1.5.11.0 的System.Runtime
and System.Threading.Tasks
.
如果没有bindingRedirect
, the Microsoft.*
程序集会尝试加载旧版本System.*
组件,这会失败。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)