The problem :
Some time ago I wrote this article :
about my problems running and debugging PowerShell scripts in VS 2012 with help of http://visualstudiogallery.msdn.microsoft.com/e3f9d3bf-e630-4b3e-968a-f86ac67b836c – PowerShell Tools for Visual Studio 2012 – wonderful tool by Adam Driscoll.
Currently after switching to Windows 8.1 + VS 2013 I reopened my project and started to work with new version of PowerShell Tools for Visual Studio 2013 – http://visualstudiogallery.msdn.microsoft.com/c9eb3ba8-0c59-4944-9a62-6eee37294597
And I was shocked! The very same problem got even worse! I wasn’t able to fix this with steps in the article. I was able to edit scripts in VS but still, I wasn’t able to debug my stuff. After some messing with other stuff I found out, that the very same problem was here some time ago and is already fixed by another people – with help of this link : http://davidfrette.wordpress.com/2011/01/20/creating-powershell-pre-build-and-post-build-events-for-visual-studio-projects/ (yes, it was the same back then in 2011)….
Solution to the problem is quite simple :
PowerShell installs in one package however there are two versions : x86 and x64 (as separate executables that I had to find on my drive) and as you might guessed correctly : they don’t share the same Get-ExecutionPolicy setting!
So you need to :
- Find x64 version of PowerShell
- set ExecutionPolicy
On my machine while running VS2013 as 32b executable :
And with the starting position like this (please note that there is no difference in title bars, you only can tell what PS you are using by the path):
I Set-ExecutionPolicy to RemoteSigned like this :
and the output in VS 2013 changed from this :
to this :
No PowerShell package on my box in add/remove programs :
I have to state 1 small thing at the end, I didn’t installed PowerShell on my box as a downloaded .exe file. If I search my installed programs, I see this (nothing) :
While I can see PowerShell 2.0 in add/remove feature in Windows 8.1 like this :
So your box setup may vary. If so, please comment below for others… Thank you! :)
Hope this helps/saves you some time….