Running powershell script from solution explorer inside Nuget Package Manager Console?

Dec 21, 2010 at 7:49 PM

I have a few powershell scripts inside my c# project. I added them to a solution folder. Would it be possible to make VS2010 run them inside the nuget powershell console by one of these methods :

  • double clicking on the file
  • right click / open with
  • custom action on the context menu
Dec 22, 2010 at 4:49 AM

We don't support these actions and honestly I don't see much value in implementing them. You can easily invoke the scripts manually.

Dec 22, 2010 at 6:53 AM

Well, since Nuget makes a powerhell console available in VS2010 and it has reference to VS2010 DTE, it is easy to use this powershell for tasks not related to nuget as well...

But if not supported, no problem... just wondered if this would be possible somehow.

Dec 22, 2010 at 3:36 PM

Why not just invoke the scripts manually as dotnetjunky suggested. If you put your scripts in an init.ps1 file, you can add new commands to the Package Manager Console. Then from within the console, you could just call the commands directly.

    Do-MyCommand -File MyFile.cs

Dec 23, 2010 at 8:39 AM

Might be an good alternative... is there an article that explains how to add custom commands ? Where do i have to put this init.ps1 script so my commands are available ?

Dec 23, 2010 at 3:38 PM

Take a look at the MvcScaffold package for a good example of this.