我遇到了以下问题。
我创建了一个针对 .net framework 4.6.2 的新 lib 项目,并通过 NuGet 引用了 System.Runtime.InteropServices.RuntimeInformation 包。(对象浏览器显示该 dll 的版本为 4.0.1.0,(在 nuget 中我指向安装版本 4.3))
我重新加载项目,以检查引用是否有问题。
现在我安装了 Microsoft.AspNetCore,我重新加载了项目,对 System.Runtime.InteropServices.RuntimeInformation 和 System.Net.Htpp 的引用消失了。
附:安装 .netstandard 包没有帮助。
有没有人有类似的问题?
System.Runtime.InteropServices.RuntimeInformation最低支持的 .net 框架版本是4.7.1. 您可以在System.Runtime.interopservices.runtimeinformation 中看到详细信息
就我而言添加
<PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)
csproj 文件有帮助。我仍然缺少引用,但是在运行项目时我没有收到任何丢失文件的异常