Deepanshu Kalra
Deepanshu Kalra

Reputation: 459

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.

Upvotes: 0

Views: 204

Answers (1)

4c74356b41
4c74356b41

Reputation: 72171

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

Upvotes: 1

Related Questions