« MovableType 3.2 | Main | Hide methods/properties from IntelliSense »

August 30, 2005

Stop solution build when a project build fails

Visual Studio .NET always try to compile every single projects in it even though there's a problem in one of the project. If you are working with a small solution with a few projects that's not too bad, however I'm currently is working with a massive solution that has 45 projects in it. A full build takes over 5 minutes, I usually go nuts when there's a compilation problem and Visual Studio .NET just happily compile the rest of the projects. That really sucks, and I'm not the only one who think that it sucks. Enrico Sabbadin shows how to stop your solution building when there's a project compilation issue.

Just in case the original article disappear, this is the meat of the article. You need to do this in your MyMacros' Environment Events module:


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", "")
Dim win As Window = DTE.Windows.Item( _
EnvDTE.Constants.vsWindowKindOutput)
Dim OW As OutputWindow = CType( _
win.Object, OutputWindow)
OW.OutputWindowPanes.Item( _
"Build").OutputString( _
"ERROR IN " & Project & _
" Build Stopped" +
System.Environment.NewLine)
End If
End Sub

Posted by vhadiant at August 30, 2005 07:47 AM





Trackback Pings

TrackBack URL for this entry:
http://www.hadianto.net/mov32/mt-tb.cgi/104

Comments

Post a comment





Remember Me?

(you may use HTML tags for style)