Reputation: 14741
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
Upvotes: 61
Views: 95258
Reputation: 434
Tools -> NuGet Package Manager -> Package Manager Settings -> go to Package Sources and remove the source that is generating the problem.
Upvotes: 0
Reputation: 1
Add new Source with following path and Tick it. https://www.nuget.org/api/v2/curated-feeds/microsoftdotnet/
Upvotes: 0
Reputation: 1
I had this problem in Visual Studio 2017 in Windows 10.
I had an existing project, and I updated the .Net Framework from 4.6.2 to 4.7.2, and the Entity Framework from 6.1.3 to 6.2.0. I rebuilt and deployed the application, but it failed to connect to my database because the reference to EntityFramework.SqlServer was broken.
I used the Package Manager UI to remove the Entity Framework from both projects in my solution. I attempted to re-add the Entity Framework, but it failed every time. I had to remove the Entity Framework from both projects and save the solution to source control (TFS), and then add the Entity Framework back in.
This successfully added the Entity Framework and the EntityFramework.SqlServer reference.
Upvotes: 0
Reputation: 1441
In my case, specifying the desidered version has solved the problem. That's probably because different projects in the same solution reference different version of the same Package. In that case, Nuget doesn't know the desidered version, hence the exception.
Just use this syntax:
Install-Package XXXX -Version A.B.C.D
Upvotes: 0
Reputation: 524
I also ran into this case when installing the AttributeRouting package. After googling a while, i tried the following steps and it works for me:
Tools > Extensions and Updates: uninstall NuGet Package Manager and reinstall it. Restart the Visual Studio.
Tools > Options > Package Manager > Package Sources: make sure to check for the nuget.org source.
Hope this help.
Upvotes: 0
Reputation: 4216
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.
In the end I got it working via:
devenv
commands : like /resetuserdata
and /resetsettings
So just note doing a full uninstall won't clear out all your settings/cache data.
Upvotes: 1
Reputation: 151
In my case, deleting all occurrences of 'EntityFramework...' files in the Bin folder (open the folder in Windows Explorer) worked form me. I didn't have the packages folder in my project. The 'EntityFramework...' files were added by different action.
NOTE: You may need to rebuild project to remove error(s).
Upvotes: 0
Reputation: 31
After updating my Visual Studio 2015 nuget stopped working.
After reading the posted solutions I founded that's a know bug, see 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
It worked
Upvotes: 2
Reputation: 1690
I deleted the project, created fresh one, first added entity framework reference. it worked.. moved necessary code back into the project
Upvotes: 0
Reputation: 69968
Had nearly the same problem on my Windows 10 machine and could't figure out why no references worked in Visual Studio 2015 after running "Get Latest Version" in TFS and why I could not restore NuGet packages. For some reason NuGet added two packages folders to the computer and I had only deleted the package folder in the project:
Locations:
C:\Users\YourUser\Documents\Visual Studio 2015\Projects\YourProject\packages C:\Users\YourUser.nuget\packages
When both of the packages folders were removed I could restore NuGet packages and everything worked again.
Upvotes: 1
Reputation: 92
Running this command from an elevated prompt resolved my issue:
regsvr32 "C:\Program Files (x86)\Common Files\microsoft shared\MSEnv\VsLangproj.olb"
Source: https://docs.nuget.org/Release-Notes/Known-Issues
Upvotes: 1
Reputation: 8098
Here is what solved it for me: VS2012 with EF6
I found my answer here: http://richardschneider.net/blog/wordpress/?p=21
From the VS command prompt, run the following command:
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
Upvotes: 7
Reputation: 1967
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.
Upvotes: 7
Reputation: 39
by clearing package Cache the problem resolved:
Tools->package Manager->Package Manager Settings-> Clear Package Cache
Upvotes: 3
Reputation: 11
I ran into the same problem. I did the following:
update-package jQuery.
Install-Package Twitter.Bootstrap -Version 3.0.0
It worked , probably because the Bootstrap -version 3.0.0 work with the JQuery most recent version.
Upvotes: 1
Reputation: 6587
The problem occurred in my entity framework version. I was using an older version of entity framework, After deleting older version of EF and re installing it with the latest version available helped me solving this issue.
Upvotes: 0
Reputation: 2973
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
Upvotes: 5
Reputation: 3699
I had this problem too, the fix that worked for me was:
Upvotes: 82
Reputation: 4994
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 'repair' did not work for me. Only complete re-install.
Upvotes: 5