c# - 安装包 : Failed to add reference to 'System.Runtime'

标签 c# .net gac

我正在尝试使用命令在我的项目中安装 Autofac nuget 包

Install-Package -Prerelease Autofac

但它失败并出现错误

Install-Package : Failed to add reference to 'System.Runtime'. Please make sure that it is in the Global Assembly Cache.

我已尝试重新安装 .NET Framework 4.5.2(这是我的项目目标版本),但收到消息“.NET Framework 4.5.2 已安装”。但是,在 C:\Windows\assembly\ 中搜索 System.Runtime.dll 没有找到任何完全匹配项(尽管有一些 System.dll 的实例。 Runtime.ni.dll,(似乎表明)它们实际上是同一个程序集...)。

我该怎么办?

project config

更新:显然我对 GAC 的位置感到困惑。 Amy启发了我,并在 C:\Windows\Microsoft.NET\assembly 中搜索,而不是我 do 找到 System.Runtime.dll。为什么 Visual Studio 没有?

最佳答案

我遇到了同样的问题。

在这里找到解决方案:https://github.com/aspnet/WebHooks/issues/18

为了修复它,我添加了 <Reference Include="System.Runtime"/>到 .csproj
项目的文件,重建它并且它工作。

关于c# - 安装包 : Failed to add reference to 'System.Runtime' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31519339/

相关文章:

c# - 从 WPF C# 中的 For 循环调用用户定义的函数

c# - 设置日期时间有问题吗?使用三元运算符为空

c# - 如何获取具有指定名称的 DataMemberAttribute 的属性?

.net - 为什么某些特定于 Azure 的程序集不存在于 Azure 实例上?

.net - 使构建过程独立于 GAC

c# - 异步鸡和蛋故事的最佳解决方案

C#如何从网络模块构建dll

c# - Entity Framework 中虚拟的目的是什么?

.net - 有条件地从列表中删除 N 项

.net - 跟踪缓慢的托管 DLL 加载