Calling another ps script from PreDeploy
segatarantino
Posts: 3
Hello. Can you help me? I've a following text in my PreDeploy.ps1
When I executed this script from PS-window - it's Ok. But when I make deploy with Red Gate, PreDeploy.ps1 seems like not working - Pack.ps1 not executed
Maybe I can't use Invoke-Expression in Red Gate?
Help me, please.[/code]
$packScriptPath = "c:\lbs\Pack.ps1" $zipperPath = "C:\Program Files (x86)\7-Zip\7z.exe" if (my condition) { Invoke-Expression "&`"$packScriptPath`" -zipperPath `"$zipperPath`" -workPath `"$RedGatePackageDirectoryPath`" }
When I executed this script from PS-window - it's Ok. But when I make deploy with Red Gate, PreDeploy.ps1 seems like not working - Pack.ps1 not executed
Maybe I can't use Invoke-Expression in Red Gate?
Help me, please.[/code]
Comments
Is it possible that the condition in: isn't evaluating to true when it's run in the context of the Deployment Agent? If you call some kind of output cmdlet (e.g. Write-Output) within the condition, does it execute?
I'm also not sure why you're using Invoke-Expression at all here. I'd suggest the following (including a Write-Output call so you can see if the condition is true):
Redgate Software
Thanx!