我正在尝试使用命令在我的项目中安装 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
,(似乎表明)它们实际上是同一个程序集...)。
我该怎么办?
更新:显然我对 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/