.net NuGet 在安装包时添加引用错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8314400/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
NuGet add reference error while installing packages
提问by Sam Farajpour Ghamari
I am not able to install any package by Nuget. For example when I want install entity framework I receive following error:
我无法通过 Nuget 安装任何软件包。例如,当我想安装实体框架时,我收到以下错误:
install-package EntityFramework
Successfully installed 'EntityFramework 4.2.0.0'.
Successfully uninstalled 'EntityFramework 4.2.0.0'.
Install failed. Rolling back...
Install-Package : Failed to add reference to 'EntityFramework'.
At line:1 char:16
+ install-package <<<< EntityFramework
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+FullyQualifiedErrorId:NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
I receive same error while installing every package from console or gui. Reinstalling nuget, disabling other extentions and running VS as admin did not help me.
从控制台或 gui 安装每个软件包时,我收到相同的错误。重新安装 nuget,禁用其他扩展并以管理员身份运行 VS 对我没有帮助。
Regards
问候
回答by Marvin
I had this problem too, the fix that worked for me was:
我也有这个问题,对我有用的解决方法是:
- Delete all the folders inside of the packages folder.
- Update all packages in Nuget Package Manager.
- 删除packages文件夹内的所有文件夹。
- 更新 Nuget 包管理器中的所有包。
回答by Artur Michajluk
Suffer the same. In the end it occurs that in
受同样的苦。最后它发生在
Tools -> Options -> Nuget Package Manager -> Package Sources
nuget.org was unchecked. Checking it solve the problem.
nuget.org 未选中。检查它可以解决问题。
回答by Dragos Durlut
Here is what solved it for me: VS2012with EF6
:这里是解决了这个问题对我来说VS2012与EF6
I found my answer here: http://richardschneider.net/blog/wordpress/?p=21
我在这里找到了答案:http: //richardschneider.net/blog/wordpress/?p=21
From the VS command prompt, run the following command:
从 VS 命令提示符运行以下命令:
regsvr32 "C:\Program Files (x86)\Common Files\microsoft shared\MSEnv\VsLangproj.olb"
After that, go to Package manager console and run the following:
之后,转到包管理器控制台并运行以下命令:
Install-Package EntityFramework -Version 6.1.3
回答by ClearCloud8
I ran into this issue as well. Unfortunately, the only solution that worked for me was completely uninstalling Visual Studio, deleting any folders left over after the uninstall, rebooting computer, and then re-installing Visual Studio.
我也遇到了这个问题。不幸的是,唯一对我有用的解决方案是完全卸载 Visual Studio,删除卸载后剩余的所有文件夹,重新启动计算机,然后重新安装 Visual Studio。
Visual Studio 'repair' did not work for me. Only complete re-install.
Visual Studio“修复”对我不起作用。只能完全重新安装。
回答by Luis Tellez
I had this problem too what i did was type in the package manager console Uninstall-Package EntityFramework -force, then delete the EntityFramework Folder in Package Folder, and then install it again Install-Package EntityFramework
我也有这个问题我所做的是在包管理器控制台中键入Uninstall-Package EntityFramework -force,然后删除包文件夹中的实体框架文件夹,然后再次安装它Install-Package EntityFramework
回答by ideaz
by clearing package Cache the problem resolved:
通过清除包缓存问题解决了:
Tools->package Manager->Package Manager Settings-> Clear Package Cache
回答by Enzo Apollonio
After updating my Visual Studio 2015 nuget stopped working.
更新我的 Visual Studio 2015 nuget 后停止工作。
After reading the posted solutions I founded that's a know bug, see http://blog.nuget.org/20150226/nuget-3.0-beta2.html
阅读我发现的已发布解决方案后,这是一个已知错误,请参阅http://blog.nuget.org/20150226/nuget-3.0-beta2.html
From Visual Studio I unistalled nuget extension, closed visual studio , downloaded and installed latest nuget version from https://dist.nuget.org/index.html
我从 Visual Studio 卸载了 nuget 扩展,关闭了 Visual Studio,从https://dist.nuget.org/index.html下载并安装了最新的 nuget 版本
It worked
有效
回答by Kijana Woodard
For me, the problem was fixed with git clean -dfx.
对我来说,问题是用git clean -dfx.
回答by Nick Josevski
When I went to Visual Studio 2015 Update 3, it broke for me, I tried many of the steps, in other answers to clear package folders / caches / etc.
当我转到 Visual Studio 2015 更新 3 时,它对我来说崩溃了,我尝试了许多步骤,在其他答案中清除包文件夹/缓存/等。
In the end I got it working via:
最后,我通过以下方式使其工作:
- Full uninstall.
- Went looking for all files/locations of visual studio (AppData/Documents/etc).
- New re-install, it still didn't work (I had missed files in other locations).
- Ran
devenvcommands : like/resetuserdataand/resetsettings - Ran a repair action.
- 完全卸载。
- 去寻找 Visual Studio (AppData/Documents/etc) 的所有文件/位置。
- 重新安装,它仍然不起作用(我错过了其他位置的文件)。
- Ran
devenv命令:喜欢/resetuserdata和/resetsettings - 进行了修复操作。
So just note doing a full uninstall won't clear out all your settings/cache data.
因此,请注意完全卸载不会清除您的所有设置/缓存数据。
回答by vanandsh
Running this command from an elevated prompt resolved my issue:
从提升的提示符运行此命令解决了我的问题:
regsvr32 "C:\Program Files (x86)\Common Files\microsoft shared\MSEnv\VsLangproj.olb"
regsvr32 "C:\Program Files (x86)\Common Files\microsoft shared\MSEnv\VsLangproj.olb"

