none
Stopping Build Gracefully?

    Question

  • Does anyone know a way to force finish a build gracefully?

    I want to do something like this.

    Code Block

    Target Name="Foo">

    <Task/>
    <Task/>
    <CallTarget Targets="CheckTarget"/>
    <CheckProperty OnError="ExitGracefully"/> <--not 100% sure how I'll implement this
    </Target>

    <Target Name="CheckTarget" inputs="xx" outputs="yy"/>
    <CreateProperty .../>
    </Target>

    <Target Name="ExitGracefully">
    ...what goes in here? This needs to stop here and continue no furthe
    </Target>

    <Target Name="CustomTargetWhichCantbeChanged" DependsOn="Foo"/>

    The reason I am doing this is because I am importing a custom target which I cannot alter, but it only needs to be done if the inputs of "CheckTarget" are newer than the outputs. (Only in this case though, normally it should be executed regardless). And I cannot use the inputs and outputs of "Foo" because there are tasks which must be executed.

    If it doesn't follow this formual exactly that's fine, as long as it achieves the end goal of exiting the build process without throwing an exception or build error, and doesn't involve changing the target declaration of 'Foo' or altering the custom target in anyway.

    Thanks for any help.
    Thursday, November 22, 2007 7:31 PM

Answers

  • Would it not work to just put a Condition attribute on the task you're concerned about? If not, make a separate target for the stuff you don't want to execute if your condition fails, and put the Condition on the CallTarget for it.

     

    Monday, November 26, 2007 4:21 PM

All replies

  •  

    Can you put the CallTarget inside CheckTarget?

     

    Dan

    Friday, November 23, 2007 5:27 PM
  • Would it not work to just put a Condition attribute on the task you're concerned about? If not, make a separate target for the stuff you don't want to execute if your condition fails, and put the Condition on the CallTarget for it.

     

    Monday, November 26, 2007 4:21 PM