Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undefined 'id' attribute in button element which is defined in code

I am currently trying to create an extension for visual studio, I have got the first button in the XML file working, however the second button throws me an error, however they are both the same except the ButtonText, LocCanonicalName and id inside of the button. Any help would be appreciated.

Error: Undefined 'id' attribute 'TestTwo' in a <Button> element - Like 29

Main part of the code:

<Commands package="CppAssist">
    <Groups>
      <Group guid="CppAssist" id="MyMenuGroup" priority="0x0600">
        <Parent guid="VSMainMenu" id="Tools"/>
      </Group>
    </Groups>

    <!--This section defines the elements the user can interact with, like a menu command or a button
        or combo box in a toolbar. -->
    <Buttons>
        <Button guid="CppAssist" id="Test" priority="0x0100" type="Button">
            <Parent guid="CppAssist" id="MyMenuGroup" />
            <Icon guid="ImageCatalogGuid" id="Add" />
            <CommandFlag>IconIsMoniker</CommandFlag>
            <Strings>
                <ButtonText>Test</ButtonText>
                <LocCanonicalName>.Tools.Test</LocCanonicalName>
            </Strings>
        </Button>

        <Button guid="CppAssist" id="TestTwo" priority="0x0100" type="Button"> <!-- Line 29: ERROR -->
            <Parent guid="CppAssist" id="MyMenuGroup" />
            <Icon guid="ImageCatalogGuid" id="Add" />
            <CommandFlag>IconIsMoniker</CommandFlag>
            <Strings>
                <ButtonText>Another Test</ButtonText>
                <LocCanonicalName>.Tools.TestTwo</LocCanonicalName>
            </Strings>
        </Button>
    </Buttons>
  </Commands>

  <Symbols>
    <GuidSymbol name="CppAssist" value="{a71b9f85-5b58-44aa-b87d-5b50fbd99202}">
      <IDSymbol name="MyMenuGroup" value="0x0001" />
      <IDSymbol name="Test" value="0x0100" />
      <IDSymbol name="TestTwo" value="0x0100" />
    </GuidSymbol>
  </Symbols>
like image 203
Callum S Avatar asked Feb 27 '26 13:02

Callum S


1 Answers

I worked out how to do this, inside the <Symbols> element, increase the <IDSymbol> value by 1.

<Symbols>
    <GuidSymbol name="CppAssist" value="{a71b9f85-5b58-44aa-b87d-5b50fbd99202}">
      <IDSymbol name="MyMenuGroup" value="0x0001" />
      <IDSymbol name="Test" value="0x0100" />
      <IDSymbol name="TestTwo" value="0x0200" />
    </GuidSymbol>
  </Symbols>
like image 65
Callum S Avatar answered Mar 02 '26 03:03

Callum S