简体   繁体   中英

Nuget: Failed to add reference to 'EntityFramework'

I tried to update a few packages using Package Manager Console, but I am getting this:

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. Important to mention, the project is under TFS source control (I did make it work when I removed TFS binding). 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). This answer explains how to setup ignore rules for 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). You may try the items below:

  1. Check Package Manager Console version to see whether it is the latest version.

  2. Try to open the package from Manage Nuget Packages, uninstall the EntityFramework package and re-install it:

    在此处输入图片说明

  3. Enable Package restore in VS:

    在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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