VS2010 - How to automatically stop compile on first compile error

Check my reply here.

I know this might be bit late, but if it helps anyone then they should install the extension VSColorOutput

Then go to Tools => Options => VSColorOutput => General => Set Stop Build on First Error to true.

Hope this helps, happy Debugging!


Edit: See now that Will beat me on this one - For VS2010 there is an add-in available that can do this, and lots more. VSCommands 2010, via http://vscommands.com/features/


(You can now download this as an extension, if you don't want to build it yourself)

This answer only works in VS2010 (seems fair :]). I've put the source up on my github page. Before you can build it, you'll need to install the SDK. Once you've done that, just grab the complete source from github (includes project files) and build that. You can install the output into your normal VS instances by finding the VSIX in your build output and opening it.

The important part is:

public void TextViewCreated(IWpfTextView textView)
{
    var dte = GlobalServiceProvider.GetService(typeof(DTE)) as DTE;
    textView.TextBuffer.Changed += (sender, args) =>
    {
        //Output window is friendly and writes full lines at a time, so we only need to look at the changed text.
        foreach (var change in args.Changes)
        {
            string text = args.After.GetText(change.NewSpan);
            if (BuildError.IsMatch(text))
                dte.ExecuteCommand("Build.Cancel");
        };
    }
}

... where BuildError is a regex defined above that you can tweak. If you have any questions about modifying the code, let me know.