Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Reworked by the comment, and founded links:</p> <p>As the menu item is shown every place it seems there is no way to distinct between them from an Add-In, you should add two command and distinct them by their context.</p> <p>The way instead of converting the Add-In to a VS-Package <a href="http://www.mztools.com/articles/2007/mz2007025.aspx" rel="nofollow">MZ-Tools HOWTO: Controlling the state of command in a Visual Studio add-in</a>, try <a href="http://www.mztools.com/articles/2007/MZ2007024.aspx" rel="nofollow">MZ-Tools HOWTO: Use the IVsMonitorSelection ...</a> you can also get it from an Add-In.</p> <p>But: </p> <blockquote> <p>Neither the AddNamedCommand nor the QueryStatus methods honor the invisible state: the button that must be invisible ... remains disabled rather than invisible.</p> </blockquote> <p>I think this makes it impossible to do it from an Add-In on a suitable way, but maybe you can check the contexts. </p> <p>Other way you could get further, if you try to migrate your command/menu into a VSPackage and create a custom <code>UIContext</code> for the menu items or find a suitable predefined one. I have no access to a Studio enhanced with Build Explorer so I can't try it.</p> <p>The following discussion is about custom contexts for vs-packages: <a href="http://davedewinter.com/2008/04/05/dynamic-menu-commands-in-visual-studio-packages-part-3/" rel="nofollow">http://davedewinter.com/2008/04/05/dynamic-menu-commands-in-visual-studio-packages-part-3/</a> <br> Sadly the links are broken from the post, and I can't reach Part 1. and Part 2. which is about the discussion of the problem from the beginning. But there is no guarantee you can create a context which suits you.</p> <p>Only context ID I found for Team Explorer is the <code>guidTeamProjectCmdUIContext</code>. It is placed at vsshilds.h in Visual Studio 2010 SDK, vsshell*.h are also contain several others.</p> <p><a href="http://msdn.microsoft.com/en-us/library/bb166366.aspx" rel="nofollow">MSDN: Vsct files</a> to define command, menus, ect. from packages.</p> <p><code>Condition</code> attribute for items: <br> <a href="http://msdn.microsoft.com/en-us/library/bb491718.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/bb491718.aspx</a> <br> <a href="http://msdn.microsoft.com/en-us/library/bb166515.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/bb166515.aspx</a></p> <p><a href="http://msdn.microsoft.com/en-us/library/bb491710.aspx" rel="nofollow">MSDN: VisibilityItem</a> element for commands and toolbars.</p> <blockquote> <p>VisibilityItem element determines the static visibility of commands and toolbars. ... After the VSPackage is loaded, Visual Studio expects command visibility to be determined by the VSPackage rather than the VisibilityItem.</p> </blockquote> <p>And finally about predefined Context Guids: <br> <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.uicontextguids80.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.uicontextguids80.aspx</a> <br> <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.uicontextguids.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.uicontextguids.aspx</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload