安装封装:无法添加引用“System.Runtime” [英] Install-Package : Failed to add reference to 'System.Runtime'

查看:4087
本文介绍了安装封装:无法添加引用“System.Runtime”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用命令



 安装封装-PRERELEASE Autofac $安装Autofac的NuGet包在我的项目b $ b  

但它失败,出现错误

 安装封装:无法添加引用System.Runtime。请确保它在全局程序集缓存。 



我试着重新安装的.NET Framework 4.5.2(这是我的版本,项目的目标是),但得到了.NET框架4.5.2已经安装的消息。然而,搜索 C:\Windows\assembly\ System.Runtime.dll 没有找到任何精确匹配(虽然有 System.Runtime.ni.dll 的几个实例,(似乎表明),它们实际上是同一个程序集...)。



我能做些什么这个





更新:显然我很困惑的GAC的位置。 艾米开导我,并在 c搜索从:\Windows\Microsoft.NET\assembly ,而不是我的的找到 System.Runtime.dll 。为什么不Visual Studio的?


解决方案

请确保它是在全局程序集缓存




这是一个的过度的无用的错误消息。它不仅没有描述真正的问题,这也导致你误入歧途大幅找到一个解决办法。对于.NET Framework程序集的程序集引用必须的从不来自GAC。那种故障模式时,它可以是极其讨厌的诊断。参考组件必须来自C:\Program文件(x86)\Reference组件目录



看着您正在尝试Autofac的NuGet包.nuspec文件安装,它支持两个不同的目标。一个是DNXCore版本4.0.10-β-22816。希望你不使用它,该项目正在迅速发生变化。



另外就是.NET可移植,轮廓259.这可让您的项目面向.NET 4.5.x,商店,Phone80和Phone81。什么钝器错误消息告诉你的是,它很难找到该配置文件。使用Windows资源管理器来一看,看到的,配置文件保存在C:\Program文件(x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.5\Profile\Profile259目录。它具有所需System.Runtime.dll的引用程序集



那么,它肯定擅离职守,我不能在根本原因猜测。



他们确实使在.nuspec文件微妙的错误。不要考虑Autofac更稳定的版本中,您可能不希望成为一个beta测试。不要针对4.5.2,没有一点了这一点。它不添加任何有趣的,并迫使用户更新自己的.NET安装不是很合理。


I'm trying to install the Autofac nuget package in my project using the command

Install-Package -Prerelease Autofac

but it fails with the error

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

I've tried re-installing .NET Framework 4.5.2 (which is the version my project targets) but got the message ".NET Framework 4.5.2 is already installed". However, searching C:\Windows\assembly\ for System.Runtime.dll doesn't find any exact matches (although there are a few instances of System.Runtime.ni.dll, which (seem to indicate) that they are really the same assembly...).

What can I do about this?

Update: apparently I was confused about the location of the GAC. Amy enlightened me, and searching in C:\Windows\Microsoft.NET\assembly instead I do find System.Runtime.dll. Why doesn't Visual Studio?

解决方案

Please make sure that it is in the Global Assembly Cache.

That is an excessively unhelpful error message. It not only doesn't describe the real problem, it also leads you drastically astray to find a workaround. An assembly reference for a .NET Framework assembly must never come from the GAC. The kind of failure modes when it does can be exceedingly nasty to diagnose. Reference assemblies must come from the C:\Program Files (x86)\Reference Assemblies directory.

Looking at the .nuspec file for the Autofac nuget package you are trying to install, it supports two distinct targets. One is for DNXCore version 4.0.10-beta-22816. Hopefully you are not using it, that project is changing rapidly.

The other is .NET Portable, profile 259. Which allows your project to target .NET 4.5.x, Store, Phone80 and Phone81. What the blunt error message is telling you is that it has trouble finding that profile. Use Windows Explorer to have a look-see, the profile is stored in the C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.5\Profile\Profile259 directory. It has the required System.Runtime.dll reference assembly.

Well, surely it awol, I can't guess at the underlying reason.

They did make subtle mistakes in the .nuspec file. Do consider a more stable release of Autofac, you probably don't want to be a beta tester. And don't target 4.5.2, there is no point to that. It doesn't add anything interesting and forcing your user to update his .NET install is not very reasonable.

这篇关于安装封装:无法添加引用“System.Runtime”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆