views:

136

answers:

1

My automated build process uses a command-line to build something like this:

devenv.exe myproj.sln /build release

It is a very long build-process which integrates components made by a team of developers. It takes about half an hour to run in release mode. Usually if one thing goes wrong then plenty of other dependancies will go wrong, so I occasionally get a message like:

---------------------- Done ----------------------
Rebuild All: 18 succeeded, 6 failed, 0 skipped

Actually I want the build to abort as soon as the first error is found. If there are any errors at all the build has failed. I need to know this as soon as possible and not wait to see all the other stuff fail.

Is there a way to change the build-process so that instead of running through the whole thing it dies as soon as something goes wrong?

I'm using Visual Studio .Net 2003 (yes I know it's old).

+6  A: 

I use the following macro in Visual Studio 2005 to do this, but it should also work in 2003. Add this to the EnvironmentEvents module in the Macros IDE:

    Private Sub BuildEvents_OnBuildProjConfigDone(ByVal Project As String, ByVal ProjectConfig As String, ByVal Platform As String, ByVal SolutionConfig As String, ByVal Success As Boolean) Handles BuildEvents.OnBuildProjConfigDone
        If Success = False Then
            DTE.ExecuteCommand("Build.Cancel")
        End If
    End Sub

This will cause the build to cancel when any single project fails to build.

This page has further details on the macros involved.

Steve Beedie