开发者

PowerShell CmdLet as Visual Studio External Tool

开发者 https://www.devze.com 2023-01-21 10:12 出处:网络
I am attempting to add a PowerShell cmdlet as an external tool in Visual Studio 2010, but whenever I call the external tool I get:

I am attempting to add a PowerShell cmdlet as an external tool in Visual Studio 2010, but whenever I call the external tool I get:

{foo} cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details.

开发者_如何学JAVA

I have already set my system's execution policy to 'RemoteSigned' (I also tried 'Bypass'), so why is this happening? I am fully able to run that same script if I open up a command line and call it via powershell.exe path\to\script.ps1 (which is exactly what my external tool definition is calling).


Are you running on a x64 system? If so, you have to set the execution for both x86 and x64 PowerShell. You can also pass the ExecutionPolicy directly as a parameter to Powershell (2.0) via the command line:

powershell.exe -ExecutionPolicy RemoteSigned -Command "&{ foo }"
0

精彩评论

暂无评论...
验证码 换一张
取 消