I a tool just downloaded that opens a Visual Studio Command prompt from within the IDE, in the root of the current project. My main gripe is that it opens an old style command window, where I would rather have a PowerShell window. According to this post, this simple change should allow this:
cmd.exe /k ""%VS120COMNTOOLS%VsDevCmd.bat" & powershell"
When I this command from outside of VS 2015, it seems to work fine and gives me a PowerShell window. Yet when I try and run it from inside VS, using the utility's menu item, it gives me this error:
Cannot load PSReadline module. Console is running without PSReadline. . : File C:\Users\brady\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170. At line:1 char:3 + . 'C:\Users\brady\Documents\WindowsPowerShell\Microsoft.PowerShell_pr ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : SecurityError: (:) [], PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess PS C:\Development\vNext\Commerce\src\Commerce.Test> Get-Execution-Policy PS C:\Development\vNext\Commerce\src\Commerce.Test> Get-ExecutionPolicy Restricted
My global execution policy is RemoteSigned
, but in the same window that show me the error, when I run a Get-ExecutionPolicy
, the returned value is Restricted
.
I have tried modifying my command to include the PS switch:
cmd /k ""%VS140COMNTOOLS%VsDevCmd.bat" & powershell -ExecutionPolicy Bypass"
But this still gives me exactly the same error.
The output of the command suggested by @PetSerAl in the comments
[Environment]::Is64BitOperatingSystem;[Environment]::Is64BitProcess;Get-ExecutionPolicy -List
gives two different results. The first in a normal PS window external to VS:
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine RemoteSigned
And the second in the only PS window I can find inside VS, the Package Manager:
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process RemoteSigned
CurrentUser Undefined
LocalMachine Undefined