通过VisualStudio运行时Powershell ExecutionPolicy错误 [英] Powershell ExecutionPolicy is wrong when run through VisualStudio

查看:92
本文介绍了通过VisualStudio运行时Powershell ExecutionPolicy错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在VS2005项目上,我正在尝试将Powershell脚本作为我的Pre-Build的一部分.我已经奔跑

I am trying to run a powershell script as part of my Pre-Build on a VS2005 project. I have run

$> powershell Set-ExecutionPolicy UnRestricted 

在构建之前从命令行

,我可以从命令行运行相同的脚本.但是,当脚本作为预构建"步骤的一部分运行时,它将失败并显示

from a command line before the build and I can run the same script from from the command line. However when the script is run as part of the Pre-Build step it fails with

The execution of scripts is disabled on this system. 
Please see "get-help about_signing" for more details. 

该脚本可在同事的x32 XP计算机上使用,而不能在我的x64 Windows7计算机上使用.

The script works on a co-worker's x32 XP machine, but not on my x64 Windows7 machine.

推荐答案

您是否在64位和32位Powershell环境中都设置了执行策略?您的64位计算机将同时具有这两个属性,并且每个计算机都有自己的执行策略设置.

Did you set the execution policy in both the 64 and 32 bit Powershell environments? Your 64 bit machine will have both, and each has it's own executionpolicy setting.

这篇关于通过VisualStudio运行时Powershell ExecutionPolicy错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆