Tag Archives: posh-git

Visual Studio 2015, Command Prompt & Powershell ExecutionPolicy

Just a hint in case you run into this problem that took a few days to discover the pattern.

I have the Productivity Power Tools 2015 installed as an extension to VS2015. These are from Microsoft and there are a ton of features in there that I can’t live without.

With this I can right click on a solution or project in Solution Explorer and open a command prompt at the relevant path.

image

I mostly use this feature to get to posh-git to run some git commands.

posh-git is a PowerShell enhanced environment for the git command line.

image

There are plenty of other reasons you may want to use PowerShell interactively with Visual Studio. Working with ASPNET5 apps is a very good reason.

The problem I encountered was that occasionally, I would get into PowerShell but my Execution-Policy was, for some reason, Restricted, so I couldn’t trigger posh-git.

image

I finally figured out how to ensure I entered the command prompt with my normal Unrestricted ExecutionPolicy.

Be sure to open the Package Manager Console in Visual Studio first. That starts up Powershell with the correct policy. Then when you open your command prompt, you are good to go.