Question

I have a build which kicks off a PowerShell script. What it does is gather code coverage metrics and then stores that info in a database. I'd like to pass a value out of that script and back into the build workflow so I can pass or fail the build based on that value.

Any ideas on how I could accomplish that?

Was it helpful?

Solution

Easiest way is to have PowerShell throw an exception. That will also cause Powershell to return a non-0 exit code. In your InvokeProcess you can either handle the Error stream or have the Result parameter assigned to a variable on your build workflow, then follow that with an if block to pass or fail the build.

Or you can return the coverage outcome using the exit function, it will be assigned to the Result property of the InvokeProcess Activity.

exit 12345;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top