简体   繁体   English

Nuget:无法添加对“ EntityFramework”的引用

[英]Nuget: Failed to add reference to 'EntityFramework'

I tried to update a few packages using Package Manager Console, but I am getting this: 我试图使用Package Manager Console更新一些软件包,但是我得到了:

update-package : Failed to add reference to 'EntityFramework'.
At line:1 char:1
+ update-package EntityFramework -reinstall
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Update-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.UpdatePackageCommand

Here are a few commands that I tried: 这是我尝试的一些命令:

Install-Package EntityFramework
Update-Package EntityFramework -Reinstall
Update-Package -Reinstall

I also tried to update packages using UI and ran VS in administrator mode. 我还尝试使用UI更新程序包,并在管理员模式下运行VS。 Important to mention, the project is under TFS source control (I did make it work when I removed TFS binding). 值得一提的是,该项目处于TFS源代码控制下(删除TFS绑定后,它确实可以正常工作)。 There are a few other packages - same thing with them. 还有其他一些软件包-与它们相同。 I see yellow exclamation next to references and I can't re-install packages. 我在参考旁边看到黄色的惊叹号,无法重新安装软件包。

I've never seen this error before, similar question answers don't work for me. 我以前从未见过此错误,类似的问题答案对我不起作用。

In my case packages where checked in TFS source control (which is of course terrible). 以我为例,在TFS源代码管理中检查了软件包(这当然很糟糕)。 This answer explains how to setup ignore rules for TFS. 答案说明了如何为TFS设置忽略规则。 After deleting packages everything was fixed. 删除软件包后,所有问题均已修复。

I've tried your commands on one of my project that under VSTS source control, no issue occurred (VS 2015.3 + Package Manager Console Host Version 3.5.0.1484). 我在VSTS源代码管理下的一个项目中尝试了您的命令,未发生任何问题(VS 2015.3 +程序包管理器控制台主机版本3.5.0.1484)。 You may try the items below: 您可以尝试以下项目:

  1. Check Package Manager Console version to see whether it is the latest version. 检查Package Manager控制台版本以查看它是否为最新版本。

  2. Try to open the package from Manage Nuget Packages, uninstall the EntityFramework package and re-install it: 尝试从Manage Nuget Packages中打开该软件包,卸载EntityFramework软件包并重新安装它:

    在此处输入图片说明

  3. Enable Package restore in VS: 在VS中启用软件包还原:

    在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM