最新版本System.Net.Http https://www.nuget.org/packages/System.Net.Http/nuget 上的版本是 4.3.4。但即使是最新的 .Net Framework 4.8 也附带了该库的 4.2.0。
即使我添加 nuget 包 Visual Studio 2019 仍然会选择System.Net.Http.dll
来自 .Net Framework 安装文件。
有什么办法可以解决这个问题吗?
.Net Core 仍然没有对 wpf 和 winforms 的设计器支持,这就是为什么我需要它与 .net 框架一起工作。
完全同意你的观点,这很令人困惑,但最后绑定重定向是你的朋友在这里与你的 app.config / web.config 文件一起使用。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<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>
</assemblyBinding>
</runtime>
</configuration>
上面的代码片段强制您的代码中包含的任何版本都将使用“newVersion”属性中指定的版本。
下表为您提供了有关版本控制差异的一些见解。
有关的一些信息绑定重定向 https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions由微软自己。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)