Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know which projects failed to build in Visual Studio

I have a solution in Visual Studio. It contains about 500 projects. When I build the solution, I get a lot of output in the output window, and also the build log. Suppose, in the end I see

Rebuid All: 250 succeeded, 10 failed, 240 skipped.

If I want to know which projects failed to build, I usually search in the output window for 1 error(s), then 2 error(s), etc. then 9 error(s). If I haven't found the 10 projects that failed using this search, then I suppose that the error count was a multiple of 10. So I search for 10 error(s), 20 error(s), etc. I usually find all failed projects this way because it is highly unlikely that the project had a number of errors which is a multiple of 100.

Question 1: Am I an idiot? What I am doing seems really idiotic to me - there has to be a better way. Which is it?

But sometimes, a project can fail for some other reasons (I assume) because today I wasn't able to find the projects that failed to build - it said 10 failed, but there were only 3 projects that had x error(s) with nonzero x. I assume that there were some projects for which some post-build steps failed or something else

Question 2: How can I find which projects failed in this case?

I am using Visual Studio 2008 SP1

Thank you very much for your help.

like image 330
Armen Tsirunyan Avatar asked Aug 16 '11 21:08

Armen Tsirunyan


People also ask

How do I see build errors in Visual Studio?

To display the Error List, choose View > Error List, or press Ctrl+\+E.

How do I fix Visual Studio build failed?

FYI. In Visual Studio 2019 Update 16.5 or later you can go to Tools > Options > Projects and Solutions > Build and Run and set 'On Run, when build or deployment error occurs' to one of the options below. Once this is set, running and debugging tests will honor this option as well.

Where do you find errors in the build?

To get help on a particular diagnostic message in Visual Studio, select it in the Output window and press the F1 key. Visual Studio opens the documentation page for that error, if one exists. You can also use the search tool at the top of the page to find articles about specific errors or warnings.


3 Answers

I prefer using the "Output View" in Visual Studio in this case (show output from Build). The reason this is better is that you can see which project was the first that failed to build. The project that fails to build there probably has the code error.

At work I might have 20 projects failing to build and 20,000 errors, all because of one line of code. This is way easier than hunting through every project.

like image 128
Elliott Beach Avatar answered Sep 27 '22 16:09

Elliott Beach


Why don't you go to the Errors view and just look in the Projects column? Sort by that, and then scroll down it noting when the value changes.

As an aside, having 500 projects in a solution sounds like a really bad idea to me. I strongly suspect it would be worth either consolidating the projects or splitting into multiple solutions.

like image 38
Jon Skeet Avatar answered Sep 27 '22 17:09

Jon Skeet


Another solution is to build your solution by MSBuild scripts instead of VS IDE. It is not necessary to write the script yourself. A visual tool such as MSBuild Sidekick may help you in generating the build scripts. You can configure your build script in such a way to break the process with the first build failure and log the project name somewhere for you.

like image 24
Gupta Avatar answered Sep 27 '22 17:09

Gupta