12

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.

Armen Tsirunyan
  • 130,161
  • 59
  • 324
  • 434
  • Holy cow! 500 projects in one solution? Why would you DO that? No wonder you're having a hard time finding which projects fail to build. Wouldn't it be easier to have smaller solutions and use a build server if you need to build them all at once? (Not that what I think matters. I just couldn't resist.) – David Aug 16 '11 at 21:12
  • @David: It's the solution at my workplace. I can't really do anything about it :) – Armen Tsirunyan Aug 16 '11 at 21:15
  • Consider the extension https://marketplace.visualstudio.com/items?itemName=EinarEgilsson.StopOnFirstBuildError#overview – Elliott Beach Feb 15 '19 at 00:59
  • https://stackoverflow.com/questions/5669765/build-visual-studio-project-through-the-command-line/5669820#5669820 Run from command line, produce output log file, (xml output may be avaiable) the parse the output. – granadaCoder Oct 26 '20 at 14:58

3 Answers3

9

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.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • View -> Error List. I've never *not* seen that in the default configuration... if you have just one error, do you only see it via the output window at the moment? – Jon Skeet Aug 16 '11 at 21:12
1

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.

Elliott Beach
  • 10,459
  • 9
  • 28
  • 41
1

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.

Armen Tsirunyan
  • 130,161
  • 59
  • 324
  • 434
TonySalimi
  • 8,257
  • 4
  • 33
  • 62