views:

275

answers:

3

Hi Everyone,

I've recently become a fan of the VSBuildStatus Visual Studio add-in which shows the status of your build in a nice graphical way. Its much more informative than the current progress bar or "Output" window. However, I can't seem to find an easy way to make it pop up during the build, then hide itself when done, which is similar to the current option in visual studio "Show Output window when build starts".

I've seen a few references to creating visual studio macros that can look for build events, but my current experience with VS macros are that they are slow and only in VB. I don't mind going that route if its the only way, but I figured I'd ask the hive mind first.

Thanks!

Jason

+2  A: 

How about a keyboard macro? I think it still generates a vb macro in the background, but I've used plenty that aren't slow.

http://www.madprops.org/blog/quick-visual-studio-keyboard-macros/

You could start recording, open the window you want, Ctrl-shift-b, stop recording, etc.

Tim Hoolihan
I did try something like this, but the macro could not open the window I wanted. It did start the build for me though.
Jason More
did you use the keyboard shortcurt for opening the window?
Tim Hoolihan
I'll have to try this. It doesn't currently have a keyboard shortcut, but I'll add one to it, then see if I can script in the shortcut.
Jason More
+3  A: 

It's not that difficult to hook up to an Environment Event:

1) Open the Macro IDE (Tools Menu --> Macros)
2) Open the 'EnvironmentEvents' module in the 'MyMacros' project
3) Add the following code after the auto-generated code:

Private Sub BuildEvents_OnBuildBegin(ByVal Scope As EnvDTE.vsBuildScope, ByVal Action As EnvDTE.vsBuildAction) Handles BuildEvents.OnBuildBegin
  DTE.Windows.Item("{43CD29AA-0CA4-4F1C-8265-219788EF4908}").Activate() 'Build Status
End Sub

You can dismiss the window by clicking anywhere outside of it.
You'll also see that it is very fast...

BTW, thanks for the addin, I didn't know about it and it is very useful indeed ;-)

Julien Poulin
Cool! I was wondering if it was something as simple as this. I did add this in the EnvironmentEvents module under the auto generated code, but it doesn't seem to be working. I am running VS2008 if that makes any difference.
Jason More
For future reference, I added the exact code below for what worked in my environment. I gave you credit though :-)
Jason More
I'm also using VS2008 (SP1) and I've set up both my work and home VS with this code with no problem (it's the same Guid for sure). Try making a new Macro Project (Tools --> Macros --> New Macro Project) and add the code to that project instead...
Julien Poulin
How do you find the Guid for that window or any window for that matter? I'd like to try this with other windows.
Ray Vega
Try and make a new macro using the Marcro Recorder. VS will automatically use the Guid to identify the window you interact with
Julien Poulin
+1  A: 

Using Julien's help with the Macro IDE editor, this is the code that worked in my environment:

Private Sub BuildEvents_OnBuildBegin(ByVal Scope As EnvDTE.vsBuildScope, ByVal Action As EnvDTE.vsBuildAction) Handles BuildEvents.OnBuildBegin
  DTE.ExecuteCommand("VSBuildStatusAddin.Connect.VSBuildStatusAddin")
End Sub

Private Sub BuildEvents_OnBuildDone(ByVal Scope As EnvDTE.vsBuildScope, ByVal Action As EnvDTE.vsBuildAction) Handles BuildEvents.OnBuildDone
    DTE.Windows.Item("{43CD29AA-0CA4-4F1C-8265-219788EF4908}").Close()
End Sub
Jason More