微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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.

原文地址:https://www.jb51.cc/windows/370573.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐