Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use NuGet PowerShell commandlets from outside Visual Studio

I was trying to use my favorite source control from the Package Manager console in Visual Studio 2010. I had issues described in another topic. For now the best answer is to move all command-line stuff from Visual Studio to bare PowerShell.

But this case the Visual Studio related commandlets are not working. For example, most crucial one — I cannot run Update-Database command from Entity Framework.

Is it possible to register somehow Visual Studio specific commandlets for the current project in PowerShell? Or make PowerShell automatically take current project context from the packages subfolder?

like image 977
shytikov Avatar asked Oct 14 '12 16:10

shytikov


People also ask

How do I access PowerShell in Visual Studio?

The integrated environment is the only configuration that runs within Visual Studio. All other configurations run in external PowerShell processes. You can open the interactive window by pressing Ctrl+Shift+\ or by navigating to View \ PowerShell \ PowerShell Interactive Window.


1 Answers

The NuGet PowerShell commands rely on being run from within Visual Studio so will not work outside in the normal PowerShell running from the command line.

You can however use migrate.exe which ships with the EntityFramework NuGet package and use that from the command line to update your database.

As a prototype I put together a way to use NuGet PowerShell commands from the normal PowerShell command line using SharpDevelop. Unfortunately at the moment the EntityFramework NuGet package does not work with SharpDevelop.

Another interesting project is StudioShell which provides a new DTE: drive inside Visual Studio but can also be used outside from the command line. I do not believe it supports NuGet PowerShell commands being run from the normal PowerShell command line.

like image 93
Matt Ward Avatar answered Oct 14 '22 12:10

Matt Ward