标签: vsct

Visual Studio 2015工具栏组合,如何正确管理用户输入的值?

我已经使用VSCT文件中的此设置为Visual Studio 2015的VSIX包中的工具栏定义了动态组合:

  <Combo guid="cmdExplorerToolbarSearchGUID" id="cmdExplorerToolbarSearchID" priority="0x0" type="DynamicCombo"
      defaultWidth="50" idCommandList="cmdExplorerToolbarSearchGetListID">
    <Parent guid="grpExplorerToolbar3GUID" id="grpExplorerToolbar3ID" />
    <CommandFlag>DynamicVisibility</CommandFlag>
    <CommandFlag>IconAndText</CommandFlag>
    <CommandFlag>StretchHorizontally</CommandFlag>
    <Strings>
      <CanonicalName>cmdExplorerToolbarSearch</CanonicalName>
      <ButtonText>Search</ButtonText>
      <ToolTipText>Search elements in the model explorer</ToolTipText>
    </Strings>
  </Combo>

</Combos>
Run Code Online (Sandbox Code Playgroud)

相应的DynamicStatusMenuCommand实例定义如下:

    command = new DynamicStatusMenuCommand(
        new EventHandler(this.OnPopUpMenuDisplayAction),
        new EventHandler(this.OnCmdExplorerToolbarSearchSelected),
        new CommandID(CmdExplorerToolbarSearchGUID, CmdExplorerToolbarSearchID));
    commands.Add(command);

    command = new DynamicStatusMenuCommand(
        new EventHandler(this.OnPopUpMenuDisplayAction),
        new EventHandler(this.OnCmdExplorerToolbarSearchGetList),
        new CommandID(CmdExplorerToolbarSearchGUID, CmdExplorerToolbarSearchGetListID));
    commands.Add(command);
Run Code Online (Sandbox Code Playgroud)

最后OnCmdExplorerToolbarSearchSelected像这样的事件处理程序:

private void OnCmdExplorerToolbarSearchSelected(object sender, EventArgs e)
{
    // Process the event arguments

    OleMenuCmdEventArgs args = e as OleMenuCmdEventArgs;
    if (args != …
Run Code Online (Sandbox Code Playgroud)

vsx vspackage vsix vsct visual-studio-2015

7
推荐指数
1
解决办法
262
查看次数

Visual Studio菜单项出现多次

我已经为我正在进行的扩展创建了一个菜单项; 但是,它在"工具"菜单中显示4次​​而不是仅显示一次.以下是我所拥有的,但我一直无法弄清楚为什么菜单项不止一次出现.

VSCT文件

<?xml version="1.0" encoding="utf-8"?>
<CommandTable xmlns="http://schemas.microsoft.com/VisualStudio/2005-10-18/CommandTable" xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <Extern href="stdidcmd.h"/>
  <Extern href="vsshlids.h"/>

  <Commands package="guidTemplatePackPkg">
    <Groups>
      <Group guid="guidTemplatePackCmdSet" id="MyMenuGroup" priority="0x0600">
        <Parent guid="guidSHLMainMenu" id="IDM_VS_MENU_TOOLS"/>
      </Group>
    </Groups>

    <Buttons>

      <Button guid="guidTemplatePackCmdSet" id="cmdidMyCommand" priority="0x2000" type="Button">
        <Parent guid="guidSHLMainMenu" id="IDG_VS_CTXT_PROJECT_ADD_REFERENCES" />
        <CommandFlag>DynamicVisibility</CommandFlag>
        <CommandFlag>DefaultInvisible</CommandFlag>
        <Strings>
          <CommandName>AddSideWaffleProject</CommandName>
          <ButtonText>Add Template Reference (SideWaffle project)</ButtonText>
        </Strings>
      </Button>
    </Buttons> 
  </Commands>

  <!-- SideWaffle Menu Options -->
  <Commands package="guidMenuOptionsPkg">
    <Groups>
      <Group guid="guidMenuOptionsCmdSet" id="SWMenuGroup" priority="0x0600">
        <Parent guid="guidSHLMainMenu" id="IDM_VS_MENU_TOOLS"/>
      </Group>
    </Groups>

    <Buttons>
      <Button guid="guidMenuOptionsCmdSet" id="cmdidOpenSWMenu" priority="0x0100" type="Button">
        <Parent guid="guidMenuOptionsCmdSet" id="SWMenuGroup" />
        <Icon guid="guidImages" id="bmpPic1" />
        <Strings> …
Run Code Online (Sandbox Code Playgroud)

c# vspackage visual-studio-extensions vsct

5
推荐指数
1
解决办法
983
查看次数

在解决方案资源管理器中将项添加到解决方案或项目节点的"添加"菜单

右键单击visual studio解决方案资源管理器时,如何为"添加"菜单项添加子菜单?

我必须添加一个子菜单项,右键单击visual studio解决方案并移动到该菜单中的Add选项.

我正在尝试使用.vsct(vs package).请帮我提出宝贵的建议

.net vsx vspackage visual-studio-extensions vsct

2
推荐指数
1
解决办法
1384
查看次数