Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

msbuild calling powershell script under windows 7 gets signing error

We have a powershell build script that calls out to other scripts that is giving me trouble under Windows 7 64 bit. It works fine under XP. I've run set-executionpolicy to RemoteSigned (and also tried it with Bypass and Unrestricted). I can pull the command line from the error message and run it myself and it all runs fine.

Build errors look terrible here; but I'm including them anyway for completeness.


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.
like image 478
Pete McKinney Avatar asked Jan 14 '10 18:01

Pete McKinney


1 Answers

Just guessing: You did run Set-ExecutionPolicy in your x64 PowerShell and the build runs the x86 PowerShell?

Maybe try Get-ExcutionPolicy in both shells.

like image 79
Filburt Avatar answered Nov 05 '22 20:11

Filburt