Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stop solution build on first compilation\link error - msbuild

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?

like image 538
ItamarBe Avatar asked Jul 16 '15 08:07

ItamarBe


3 Answers

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

like image 153
anish Avatar answered Nov 13 '22 15:11

anish


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

like image 40
Techtwaddle Avatar answered Nov 13 '22 16:11

Techtwaddle


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.

like image 42
vbp13 Avatar answered Nov 13 '22 14:11

vbp13