Thread: Failure Steps
View Single Post
Old 03-06-2003, 07:54 PM
kinook kinook is online now
Join Date: 03-06-2001
Location: Colorado
Posts: 5,758
There are a couple ways to stop the build from within a build:
1) a Run Program step with a bogus command-line;
2) a Run Script step with the code:
Err.Raise 1, Step.Name, "Step failure message" ' VBScript, or
throw 1; // JScript

The drawback to this approach in your case is that the step that actually failed would be marked successful and the user would need to manually uncheck/recheck and start the build from that step after fixing the problem.

Since you want to conditionally cause a build to stop on failure based on the whether the build is GUI/console, another option would be to modify the 'Ignore failure' flag of the ISStep before it gets built. Set the step to not ignore failure (so that it will stop if it fails when built in the GUI), and add a Run Script step right before it with this code (VBScript):

If Application.Context = vbldContextCommandLine Then
Project.Steps(Step.Type)(Builder.BuildIndex+1).Ign oreFailure = True
End If
Reply With Quote