Powershell error messages not showing up in the Octopus deployment log (NuGet packages)

Hi.
When I try to deploy a NuGet package which contains a Deploy.ps1 file, the error messages resulting from the execution are not shown in the deployment log. Standard-output messages are there but “throws” are not. This makes deployments very hard to troubleshoot.

The script execution is interrupted and the deployment is reported as failed.

Is this by design for some reason? If not, Is there anything we can do in the scripts to get it working? Would there be a fix for this soon?

The Deploy.ps1 script is similar to this:
@@@
Write-Output "Starting the real deployment script…"
cd .\content\Deploy
.\do-the-deploy.ps1 -sourceRootBinariesDir “…\” -backupsDir "E:\BackUps"
Write-Output “The real deployment script script has finished OK”
@@@

The real deployment script is failing with a line similar to this:
@@@
throw “Couldn’t find required dependency .NET 4.5. Install .NET 4.5 before deploying the application”
@@@

But this error message is not showing up in the Octopus deployment log:
@@@
2013-02-27 16:07:46 INFO ****** INFO: Verifying the pre-requisites
@@@
The error message should be HERE but it’s not…
@@@
2013-02-27 16:07:46 INFO
2013-02-27 16:07:50 INFO Unhandled error: System.Management.Automation.ActionPreferenceStopException: Command execution stopped because the preference variable “ErrorActionPreference” or common parameter is set to Stop: *** Could not deploy package.
at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
at System.Management.Automation.Runspaces.Pipeline.Invoke()
at Octopus.Tentacle.Deployment.Integration.PowerShell.PowerShellRunner.IsolatedScriptRunner.Execute(PowerShellArguments arguments) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Deployment\Integration\PowerShell\PowerShellRunner.cs:line 77
2013-02-27 16:07:50 DEBUG Script ‘D:\Octopus\INT\Trayport.ClearingHub\0.0.6\Deploy.ps1’ completed with return code -8.
2013-02-27 16:07:50 ERROR Octopus.Tentacle.Deployment.Integration.PowerShell.ScriptFailureException: PowerShell script ‘D:\Octopus\INT\Trayport.ClearingHub\0.0.6\Deploy.ps1’ returned non-zero exit code: -8. Deployment terminated.
at Octopus.Tentacle.Deployment.Conventions.PowerShellConvention.RunScript(String scriptName, ConventionContext context) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Deployment\Conventions\PowerShellConvention.cs:line 22
at Octopus.Tentacle.Deployment.Conventions.PowerShellDeployScript.Install(ConventionContext context) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Deployment\Conventions\PowerShellDeployScript.cs:line 15
at Octopus.Tentacle.Deployment.DeploymentController.RunInstallConventions(ConventionContext context) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Deployment\DeploymentController.cs:line 123
at Octopus.Tentacle.Deployment.DeploymentController.Execute(StoredPackage package, VariableDictionary variables, IActivityLog log) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Deployment\DeploymentController.cs:line 65
2013-02-27 16:07:50 ERROR Running rollback conventions…
@@@

Hi,

Thanks for letting me know, I will try to make sure this is fixed in the next release.

Paul

This has been fixed in 1.4

Thanks