简体   繁体   中英

Pass a value from powershell to TFS Build Workflow

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?

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM