c# - NetStandard/Net Framework 引用 hell

标签 c# .net .net-standard .net-4.7

我有一个引用外部库(System.Runtime.Loader,从 NuGet 获取)的 NetStandard 1.6 库。如果我从 Net Framework 4.7 Windows 应用程序引用我的 NetStandard 库,我会在运行 Net Framework 应用程序时收到 System.IO.FileNotFoundException。

完全异常:

System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.'

现在,我完全了解异常消息的含义,但对于如何在这种情况下解决它还一头雾水。

想法?

最佳答案

我建议你右击visual studio解决方案,去manage nuget packages for the solution并检查你拥有的各种库的版本。库之间的任何冲突都将出现在“合并”选项卡中。或者,尝试从项目的引用文件夹中删除库引用并将其添加回来。

关于c# - NetStandard/Net Framework 引用 hell ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45439987/

相关文章:

.net - 使用 .NET Core SDK 预览版不再工作

c# - EF4 代码优先 - 从数据库中删除父项时删除所有子项?

.net-standard - AppVeyor 的 .NET Core .csproj 补丁没有任何影响

VS2017的MSBuild无法编译.NET Standard 2.0项目

c# - 不允许在正则表达式中使用空格

c# - 无法在Elasticsearch中的搜索文本中转义双引号(“)?

c# - 开源库是否应该进行数字签名

xamarin - ResourceManager 对于默认区域性返回 null

c# - if 语句后的变量声明

c# - 自定义标签中的正则表达式替换