8

I'm compiling a solution with many projects inside using VS2013's MSBuild. I want the build to stop if one of the projects fails to compile and that the error code of msbuild will be non-zero to indicate something has failed. Can it be done?

I am running this command to start compiling:

%MS_BUILD_PATH% "%workarea%\WindowsSolution.sln" /p:Configuration=Release /p:ContinueOnError=false /p:StopOnFirstFailure=true

but it doesn't work as I want it. Any suggestions?

Vertexwahn
  • 7,709
  • 6
  • 64
  • 90
ItamarBe
  • 482
  • 1
  • 5
  • 12

3 Answers3

13

If anyone is still looking for this feature in Visual Studio, there is a free extension called [VSColorOutput] (here), which has an option to stop the build on first build error. Once you have installed the extension, the options is located at: Tools.Options.VSColorOutput.Build Actions.Stop Build On First Error

haku
  • 4,105
  • 7
  • 38
  • 63
3

The official documentation says StopOnFirstFailure: If true, when one of the projects fails to build, no more projects will be built. Currently this is not supported when building in parallel (with multiple processors).

Can you try setting BuildInParallel=false and see if that helps?

Edit: Found an old blog post that says this might be easy to do if you're building a single .sln with multiple projects http://blogs.msdn.com/b/manishagarwal/archive/2006/05/09/593392.aspx

Techtwaddle
  • 1,643
  • 1
  • 15
  • 11
3

I'm using StopOnFirstBuildError

https://marketplace.visualstudio.com/items?itemName=EinarEgilsson.StopOnFirstBuildError

It stops the build when the any project building fails. I'm using on 2015. The linked page says it works with Visual Studio 2012, 2013, 2015, 2017.

vbp13
  • 1,040
  • 1
  • 10
  • 20