Search code examples
visual-studiopowershellvisual-studio-2015nugetpowershell-cmdlet

Include custom cmdlets in Visual Studio PowerShell window


My company is using Visual Studio 2015 which has the very practical PowerShell Interactive Window and also the NuGet Paket Manager Console, which is basically a PowerShell host.

We would like use some of our own cmdlets in one of these windows. Is there any way I can configure to load them 'automatically', similar to the auto-loaded user profile in PowerShell? Preferably based on the currently opened solution, if possible.

Please consider: Using the regular PowerShell profile will not work, because it is not loaded in these windows. Also, even if it did work, this would be a solution on a per user basis only.

(Note: These cmdlets are script cmdlets, but I think/hope this won't make a big difference.)


Solution

  • Start your powershell interactive / Nuget package manager window and type $profile. You'll see where your profile is defined. You can then add your own cmdlets to that profile. See this article for more information.