I found this, but some sample code would be useful.
I have set up the context menu in the .vstc file using IDM_VS_CTXT_PROJNODE. That works fine.
I have set up <CommandFlag>DefaultInvisible</CommandFlag> and <CommandFlag>DynamicVisibility</CommandFlag> for the button in .vstc.
But I'm having trouble getting the BeforeQueryStatus event to fire at the right time. Sample code to hook up the event correctly and also handle it would be useful. For example, just show the menu button if the project is a console app project type.