tags:

views:

136

answers:

2

With MSBuild, as soon as an error occurs, the execution of the project is stopped unless ContinueOnError=true.

Is there a way to stop the execution of the project without raising an error?

I'd like to have this possibility because I have an existing set of msbuild project files and in some circumstances, I would need to stop processing the projects without raising an error because it is a normal exit point for the process and I don't want the person using the script to think something is wrong.

I know I could just set some property and put all remaining tasks conditional on this but I would like to avoid that.

A: 

What do you mean "normal exit point". If the targets are not completed which were targeted then how can this be normal? Can you explain in more detail what you are trying to accomplish so that we can understand what exactly you need?

Sayed Ibrahim Hashimi
+1  A: 

As you explain it, you want to stop your build under special circumstance without raising an error because it is a normal exit point. Why not create a target doing nothing that will serve as your exit point. Under your special conditions you will call this target.

<target Name="BuildProcess">
   <Message Text="Build starts"/>
   ...
   <CallTarget Targets="Exit"
               Condition="Special Condition"/>

   <Message Text="Build continue"/>  
   ...     
</target>

<target Name="Exit">
  <Message Text="Build ended because special condition occured"/>
</target>
madgnome