C# 无法使用.net 4.6.2中的.net标准2.0库找到System.Runtime 4.1.0.0

C# 无法使用.net 4.6.2中的.net标准2.0库找到System.Runtime 4.1.0.0,c#,asp.net,.net,visual-studio-2017,.net-standard,C#,Asp.net,.net,Visual Studio 2017,.net Standard,我创建了一个.NET标准2.0库,并尝试在一个4.6.2 web api项目中使用它 当我尝试运行我的web api时,我得到: Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definitio

我创建了一个.NET标准2.0库,并尝试在一个4.6.2 web api项目中使用它

当我尝试运行我的web api时,我得到:

Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
在我的web配置中,我有以下重定向:

<dependentAssembly>
    <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>

我在WebAPI项目中使用.NET标准1.6作为nuget包。我做错了什么?(我在WebAPI项目中将.NET标准升级为2.0,但这也没有什么不同)

当我检查bin文件夹时,System.runtime.dll版本为4.6.255。为什么版本高于它添加的nuget包

我的package.config文件包含:

<package id="System.Runtime" version="4.1.0" targetFramework="net462" />

这个问题似乎与您的问题相似,请看一看


此处详细描述了问题:。解决方案在解决方案一节中介绍


因此,在构建web应用程序时,绑定重定向问题将显示在警告中。在Visual Studio中,您需要双击该警告,系统会询问您是否要添加丢失的绑定重定向。

是否有任何理由不将版本重定向更新到4.6.255?@KevinHirst我尝试重定向到4.6.255,但也没有帮助。我想知道在.net framework 4.6.2项目中使用.net标准库是否存在某种问题?@Win我看到了这条线索,但它对我没有帮助。看看微软说的话,Idk,也许有人讨厌我引用了另一个问题:)这应该是一个评论,而不是答案。如果另一个问题回答了这个问题,那么这应该是重复的。这也是一个只有链接的答案,也不是一个答案。好吧,对不起,我做错了,我还是新来的,下次我会做对的,谢谢你的解释。