简体   繁体   中英

Powershell in MsBuild: Check if script succeeded?

I am using a powershell script to perform a few tasks that are pre requisites for my MsBuild. The script is called from the build itself. How do i check if the script succeeded so that my build can continue, else fail.

The easiest way would be to return a non exit zero code from your script that would indicate that the build failed. So something like this at the end of the script:

if ($error) { exit 1 }

that would exit with a code of 1 if any errors occured during the script

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