Welcome to MSDN Blogs Sign in | Join | Help

Stopping the build after first (compilation) error in team build

 

Scenario -

We are building multiple solutions in our Team Build project file. We want to halt the build when the first compile error is encountered.

 

Answer

 

If you are building multiple solutions (sln's) and you encounter error in any sln, the build process will not stop after that sln and will continue to build the rest of solutions. The reason is that MSBuild task in core compile will be invoked for each solution specified in the item group due (@(SolutionToBuild))

 

To stop the build after getting the build break and not continue building rest of solutions, you need to make the following changes –

  • Modify the file Microsoft.TeamFoundation.Build.targets file to add the additional option of "StopOnFirstFailure" (specified by yellow text)

ADD -

<!-- If user has not specified the option anything default behavior should be to build all slns -->
<
PropertyGroup>

<StopOnFirstFailure>false</StopOnFirstFailure>

</PropertyGroup>

<!-- In target CORECLEAN -->

<MSBuild

Projects="@(SolutionToBuild)"

StopOnFirstFailure="$(StopOnFirstFailure)"

Properties="Configuration=$(FlavorToBuild); ..."

Targets="Clean" /> 

<!-- In target CORECOMPILE -->

<MSBuild

Condition=" '@(SolutionToBuild)'!='' "

Projects="@(SolutionToBuild)"

StopOnFirstFailure="$(StopOnFirstFailure)"

Properties="Configuration=$(FlavorToBuild);..."

Targets="Build" />

  • Now if you want to stop the build in first failure, edit your build type (tfsbuild.proj) and override/redefine the property "StopOnFirstFailure" (specified by yellow text).

<PropertyGroup>

     <StopOnFirstFailure>true</StopOnFirstFailure>

</PropertyGroup>

 

 

If you are building a solution with multiple projects (.xxproj's) and you encounter an error in first .csproj, then build will not stop immediately but will iterate over all the remaining projects (csproj). 

 

 

 

Published Monday, May 08, 2006 1:00 PM by ManishAgarwal

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# comments by raju

hi this venkat raju
Monday, May 08, 2006 3:13 AM by kvraju141

# VSTS Links - 05/08/2006

Etienne Tremblay is going to speak about Team System at DevTeach. He is also doing a webcast on adopting...
Monday, May 08, 2006 10:53 AM by Team System News

# re: Stopping the build after first (compilation) error in team build

gay hairy dad
young teen boy videos
black gay women
young gay teens online community
boy teen gay
Thursday, August 24, 2006 9:58 PM by father son and the holy ghost symbol

# re: Stopping the build after first (compilation) error in team build

"If you are building a solution with multiple projects (.xxproj's) and you encounter an error in first .csproj, then build will not stop immediately but will iterate over all the remaining projects (csproj). "

How can I make it to stop after the first compilation error?

p.s

I am working with Visual Studio .NET 2003

Thanks in advance,

Roi

Tuesday, November 28, 2006 2:41 AM by roi

# SolutionToBuild has invalid element for namespace in http://schemas.microsoft.com/developer/msbuild/2003

hi,

I have create the new build type,after that i have compiled but compilation mesage is appeared as faild.i have open my new buid configuration file.

>>>>>'SolutionToBuild' has invalid element for namespace in http://schemas.microsoft.com/developer/msbuild/2003,but configuration i need to resolve this issue.Please give me the solution.

Please sent me solution regarding this issue on rifaqats@gmail.com .

Thanks & Regards

Rifaqat Ali

Wednesday, September 12, 2007 4:45 AM by Rifaqat Ali

# MSBUILD | hilpers

Tuesday, January 20, 2009 9:14 AM by MSBUILD | hilpers

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker