7

I know that I could sort the build output of my multicore builds in Visual Studio using the Build Order item in the Output window (as described here).

But once I've done that and hit F7 again, the option switches back to Build and I have to switch back to Build Order again.

Is there a way to set Build Order as default setting in the Output window?

Searching a bit shows me that this question was asked several times but never answered:


Edit:
The answer given by Simon works for me (or at least it points me to the right direction), but I could not simply copy his code and insert it in my MyMacros project. Instead, I have to create the handler for the build events exactly as described here:

  1. On the Class View explorer pane, in the Macros IDE, double-click the EnvironmentEvents node to display it as an EnvironmentEvents tab and a drop-down menu on the macro editor pane.

  2. From the EnvironmentEvents drop-down menu, select an events type, such as TaskListEvents. The Declarations combo box is now populated with the available Task List events.

  3. On the Declarations drop-down menu, select an event, such as TaskAdded, to add its event procedure to the module.

The event is inserted into your macro and you can now add code to the event procedure.

Otherwise, the event handler isn't called at all.

Community
  • 1
  • 1
eckes
  • 64,417
  • 29
  • 168
  • 201

1 Answers1

3

You could write a Visual Studio macro, something like this:

Dim WithEvents MyBuildEvents as BuildEvents

Private Sub BuildEvents_OnBuildBegin(ByVal Scope As EnvDTE.vsBuildScope, ByVal Action As EnvDTE.vsBuildAction) Handles MyBuildEvents.OnBuildBegin
    OpenBuildOrderOutputPane()
End Sub

Private Sub OpenBuildOrderOutputPane()
    Dim window As Window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput) ' Get Output Window
    Dim output As OutputWindow = CType(window.Object, OutputWindow)
    For Each pane As OutputWindowPane In output.OutputWindowPanes ' Browse panes
        If (pane.Guid = "{2032B126-7C8D-48AD-8026-0E0348004FC0}") Then ' Build Order guid
            pane.Activate()
        End If
    Next
    window.Activate()
End Sub

You need to paste this code in MyMacros, EnvironmentEvents module.

eckes
  • 64,417
  • 29
  • 168
  • 201
Simon Mourier
  • 132,049
  • 21
  • 248
  • 298
  • had to modify your answer in order to get it going. – eckes Jan 17 '13 at 12:44
  • Maybe because you're running off VS 2005. This change is not needed on VS 2010 (there is some auto generated code that does it) – Simon Mourier Jan 17 '13 at 12:51
  • yep. With VS2005, I **have to** create the build event handler as described here: http://msdn.microsoft.com/en-us/library/0b27f9kz(v=vs.80).aspx They rely on the generated code, otherwise the handlers aren't getting called... – eckes Jan 17 '13 at 13:27