我们有一个powerhell构建脚本,可以调用其他脚本,这些脚本在
Windows 7 64位下给我带来麻烦.它在XP下工作正常.我已经运行set-executionpolicy到RemoteSigned(并尝试使用Bypass和Unrestricted).我可以从错误信息中拉出命令行,并自行运行,并且运行正常.
Project "C:\dev7\Source\DashPortal\DashboardGenerator\DashboardGenerator.csproj" (2) is building "C:\dev7\Source\DashPo rtal\DashboardController\DashboardController.csproj" (15) on node 0 (default targets). File C:\Users\pmckinney.NA\Documents\WindowsPowerShell\profile.ps1 cannot be lo aded because the execution of scripts is disabled on this system. Please see "g et-help about_signing" for more details. At line:1 char:2 + . <<<< 'C:\Users\pmckinney.NA\Documents\WindowsPowerShell\profile.ps1' + CategoryInfo : NotSpecified: (:) [],PSSecurityException + FullyQualifiedErrorId : RuntimeException File C:\dev7\Source\DashPortal\DashboardController\..\..\..\Build\createReportI nstallScript.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details. At line:1 char:87 + C:\dev7\Source\DashPortal\DashboardController\..\..\..\Build\createReportInst allScript <<<< -t C:\dev7\Source\DashPortal\DashboardController\..\..\..\Sourc e\DashPortal\DashboardReports\ReportSetupScriptTemplate.sql -l C:\dev7\Source\D ashPortal\DashboardController\..\..\..\Source\DashPortal\DashboardReports\Repor tSetupReportList.xml -c C:\dev7\Source\DashPortal\DashboardController\..\..\..\ Source\DashPortal\Config + CategoryInfo : NotSpecified: (:) [],PSSecurityException + FullyQualifiedErrorId : RuntimeException C:\dev7\Source\DashPortal\DashboardController\DashboardController.csproj(265,5): error MSB3073: The command "powershell C:\dev7\Source\DashPortal\DashboardController\..\..\..\Build\createReportInstallScript -t C:\dev7\Source\DashPortal\Da shboardController\..\..\..\Source\DashPortal\DashboardReports\ReportSetupScriptTemplate.sql -l C:\dev7\Source\DashPorta l\DashboardController\..\..\..\Source\DashPortal\DashboardReports\ReportSetupReportList.xml -c C:\dev7\Source\DashPorta l\DashboardController\..\..\..\Source\DashPortal\Config" exited with code 1.
只是猜测:您在x64 PowerShell中运行了Set-ExecutionPolicy,构建运行x86 PowerShell?
也许在两个shell中尝试Get-ExcutionPolicy.