msbuild调用Windows 7下的powershell脚本获取签名错误

我们有一个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.

相关文章

Windows2012R2备用域控搭建 前置操作 域控主域控的主dns:自...
主域控角色迁移和夺取(转载) 转载自:http://yupeizhi.blo...
Windows2012R2 NTP时间同步 Windows2012R2里没有了internet时...
Windows注册表操作基础代码 Windows下对注册表进行操作使用的...
黑客常用WinAPI函数整理之前的博客写了很多关于Windows编程的...
一个简单的Windows Socket可复用框架说起网络编程,无非是建...