VsixCommunity / Community.VisualStudio.Toolkit

Making it easier to write Visual Studio extensions
Other
249 stars 44 forks source link

Command Bitmap Not Shown #425

Closed gnimor closed 1 year ago

gnimor commented 1 year ago

I have created a simple command plug-in and I want to show a different Bitmap for the item. So I changed my VSCT as follows:

<?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"/>
  <Include href="KnownImageIds.vsct"/>
  <Include href="VSGlobals.vsct"/>
  <Commands package="GitCleanExtensions">
    <Groups>
      <Group guid="GitCleanExtensions" id="MyMenuGroup" priority="0x0600">
        <Parent guid="VSMainMenu" id="Tools"/>
      </Group>
    </Groups>
    <Buttons>
      <Button guid="GitCleanExtensions" id="GitCleanCommand" priority="0x0100" type="Button">
        <Parent guid="GitCleanExtensions" id="MyMenuGroup" />
        <Icon guid="guidImages" id="bmpPic1" />
        <CommandFlag>IconIsMoniker</CommandFlag>
        <Strings>
          <ButtonText>Git Clean</ButtonText>
          <LocCanonicalName>.GitCleanExtensions.GitCleanCommand</LocCanonicalName>
        </Strings>
      </Button>
    </Buttons>
    <Bitmaps>
      <Bitmap guid="guidImages" href="Resources\DummyCommand.png" usedList="bmpPic1, bmpPic2, bmpPicSearch, bmpPicX, bmpPicArrows, bmpPicStrikethrough"/>
    </Bitmaps>
  </Commands>
  <Symbols>
    <GuidSymbol name="GitCleanExtensions" value="{b887d7ce-4257-4c49-8582-c56b320a821d}">
      <IDSymbol name="MyMenuGroup" value="0x0001" />
      <IDSymbol name="GitCleanCommand" value="0x0100" />
    </GuidSymbol>
    <GuidSymbol name="guidImages" value="{90e10b14-059e-48ff-9e53-9c925306df44}" >
      <IDSymbol name="bmpPic1" value="1" />
      <IDSymbol name="bmpPic2" value="2" />
      <IDSymbol name="bmpPicSearch" value="3" />
      <IDSymbol name="bmpPicX" value="4" />
      <IDSymbol name="bmpPicArrows" value="5" />
      <IDSymbol name="bmpPicStrikethrough" value="6" />
    </GuidSymbol>
  </Symbols>
</CommandTable>

But the icon does not show up. I also changed the corresponding bitmap file without success. When I use the default VSIX project template the icon shows up. Did I miss something or is the icon not possible with the community template?

reduckted commented 1 year ago

<CommandFlag>IconIsMoniker</CommandFlag> indicates that the icon refers to one of Visual Studio's built-in icons. If you remove that line, it should work.

gnimor commented 1 year ago

Yes, that did the trick. It seems I missed the description for the command flag node