1

I have installed VS 11 Pro Beta and opened my MVC4 solution that uses EF4.3 code first with migrations. This solution works fine on the same machine under VS 2010: I can Add-Migration's and Update-Database as well.

But in VS11 I get following erros in Package Manager Console:

PS D:> Update-Database
System.Management.Automation.CommandNotFoundException: The term 'Get-Project' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
at System.Management.Automation.StatementListNode.ExecuteStatement(ParseTreeNode statement, Array input, Pipe outputPipe, ArrayList& resultList, ExecutionContext context)
at System.Management.Automation.StatementListNode.Execute(Array input, Pipe outputPipe, ArrayList& resultList, ExecutionContext context)
at System.Management.Automation.TryStatementNode.Execute(Array input, Pipe outputPipe, ArrayList& resultList, ExecutionContext context)
The term 'Get-Project' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

even after opening the console the "Package Manager Console Host Version 1.6.30117.9648" open up, but event the basic help command doesn't work:

PS D:> get-help NuGet
Get-Help : Cannot find Help for topic "NuGet".
At line:1 char:9
+ get-help <<<< NuGet
+ CategoryInfo : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

At the same time I can use NuGet GUI to install packages normally. Please help to make migrations working.

twk
  • 3,122
  • 2
  • 26
  • 36
  • If you use **Entity Framework** you can have a look at my answer on [The term 'Update-Database' is not recognized as the name of a cmdlet](http://stackoverflow.com/questions/9674983/the-term-update-database-is-not-recognized-as-the-name-of-a-cmdlet). – Murat Yıldız Apr 24 '16 at 21:10

6 Answers6

0

This is likely the result of a known issue where the NuGet console in Visual Studio doesn't always start up correctly. While this race condition sometimes happens in VS 2010 as well, it seems to be happening much more often in VS11. We plan to fix it in the upcoming 1.8 release. A work-around is to re-start VS11, and make sure the console works correctly by trying a NuGet command. It might take a few restarts. I know this sucks; we're sorry and we'll work to fix it.

half-ogre
  • 594
  • 3
  • 7
  • does this also include the case where NuGet commands work (install-package etc) but package ones dont? (eg EF 4.3's Add-Migration) – Betty Mar 06 '12 at 21:20
  • @Betty, no, that sounds like a different problem. Please feel free to [start a discussion](http://nuget.codeplex.com/discussions/create) or [report a bug](http://nuget.codeplex.com/WorkItem/Create) and we can try to help. – half-ogre Mar 07 '12 at 23:52
0

Not sure if anyone is still struggling with this, but I started to follow @IanFelton's advice. I opened up VS11 as an Administrator to remove and reinstall NuGet, and the NuGet console fired up correctly. A few more VS restarts and it seems to be a consistent workaround.

Ben
  • 308
  • 2
  • 13
-1

Not sure if this helps, but...

I had virtually the same issue with PM. I found that when opening a solution file directly (via right click on tool bar) PM wouldn't initialize, but if I opened VS11 without a solution, initialized PM and then loaded my project solution it worked fine.

Simon
  • 2,810
  • 2
  • 18
  • 23
-1

For me it worked if I downloaded and installed the VSIX manually http://visualstudiogallery.msdn.microsoft.com/27077b70-9dad-4c64-adcf-c7cf6bc9970c

No need of repeated reboots. Worked after first, but I could have been lucky.

slang
  • 626
  • 7
  • 26
Daniel
  • 8,133
  • 5
  • 36
  • 51
-1

I think there are a few reasons nuget can be broken in VS 11. For me, the answer was to uninstall NuGet from "Add/Remove Programs". I tried uninstalled Nuget from VS 11 Extension manager and reinstalling, but that didn't help. Then I closed VS 11, went to "Add/Remove Programs", and noticed it was also installed there. So I uninstalled it and nuget seems to work.

I don't know if this is related, but before I uninstalled from "Add/Remove programs", my prompt in the Package Manager Console showed the path to my solution. After uninstalled, it just shows "PM>".

While this seemed to fix most of my errors, I still saw errors in Package Manager Console while VS is loading IF I load a solution file directly from the recent list on the Windows start menu. If I open VS 11 without a solution first and then open my solution, I don't get any errors at all in the Package Manager Console.

Update: Since my first post, VS 11 has gotten to a point where none of the Entity Framework Code-first Migrations commands are working. The only workaround I've found that works is to run the following command from the "Package Manager Console":

Import-Module \*PathToSolution*\packages\EntityFramework.5.0.0-beta2\tools\EntityFramework.psd1

After running the above, Add-Migration, Update-Database, etc. was available again.

Josh Mouch
  • 3,480
  • 1
  • 37
  • 34
-1

Reinstall NuGet within Visual Studio using Extension Manager.

Ian Felton
  • 229
  • 1
  • 5