Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet add reference error while installing packages

I am not able to install any package by Nuget. For example when I want install entity framework I receive following error:

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.

Regards

like image 222
Sam FarajpourGhamari Avatar asked Nov 29 '11 16:11

Sam FarajpourGhamari


People also ask

How do I force a NuGet package to install?

Switch to the Browse tab, search for the package name, select it, then select Install). For all packages, delete the package folder, then run nuget install . For a single package, delete the package folder and use nuget install <id> to reinstall the same one.

How do I install NuGet packages missing?

Enable package restore by choosing Tools > Options > NuGet Package Manager. Under Package Restore options, select Allow NuGet to download missing packages. In Solution Explorer, right click the solution and select Restore NuGet Packages.

How do I add a reference Nupkg file in Visual Studio?

You first have to tell Visual Studio about the location of your package, and then you can add it to a project. What most people do is go into the NuGet Package Manager and add the local folder as a source (menu Tools → Options → NuGet Package Manager → Package Sources).


1 Answers

I had this problem too, the fix that worked for me was:

  1. Delete all the folders inside of the packages folder.
  2. Update all packages in Nuget Package Manager.
like image 62
marvc1 Avatar answered Oct 17 '22 02:10

marvc1