3

I have a similar question as given in Automatically stop Visual C++ 2008 build at first compile error but specifically for building from the command line with command-lines such as devenv.exe someproject.sln /build Release /project flubber. I want the build to stop upon the first error. Will the macro solution work from the command line too, or will it only work from the IDE? My guess is that it only works from the IDE.

If that is the case, then is there a way to do this cleanly such the project I build continues to build identically with what the devenv.exe command-line interface would do (even if it means using MSBuild)?

Other pages I scanned, but that seemingly did not answer the question:

  1. How to Automatically Stop a Visual Studio Build on an Error
  2. Customize Your Project Build Process
  3. Visual Studio - Stopping a Multi-Project build at the first compile error
Community
  • 1
  • 1
bgoodr
  • 2,744
  • 1
  • 30
  • 51

1 Answers1

2

The macro solution linked will definitely only work when the full IDE is open since it relies on checking the output window. Also, building from the command-line with devenv.exe will just internally use MSBuild so basically you need a solution that tells MSBuild to stop on first failure. Unfortunately, there is no easy way to do that when building from a solution file. There is a StopOnFirstFailure property for MSBuild but it doesn't work as expected with multiple projects within a solution.

Your best bet is this hack mentioned here. Basically you need to convert your *.sln to a *.proj and set RunEachTargetSeparately to false. The only uncertainty is that this might not quite work with Visual C++ 2008 since it still uses VCBuild internally instead of 100% MSBuild like with Visual Studio 2010.

Community
  • 1
  • 1
Scott Lerch
  • 2,620
  • 1
  • 23
  • 34