Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I know the title sounds unwieldy but as I am beginning convert an existing COM interface to Add-Ins, I am having trouble adding a button to a root menu.

I have an AddIn.Button that is used both as a button (in Add-In Controls) and an item in a rootmenu. The button works but when I add the namespace.classname to the .esriaddinx (as a Button refID="...", I get the modifier "static' and "internal" errors from the config.designer.cs. How do I reference this addin.button in the rootmenu so it can build the designer correctly?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

I did this successfully: Opened VS2010, choose to create a new Arcmap Add-in project. Edited the xml by hand to look like this:

<ESRI.Configuration xmlns="http://schemas.esri.com/Desktop/AddIns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Name>ArcMapAddin1</Name>
  <AddInID>{1a65703b-71ec-43e0-901c-d9efbb52da7b}</AddInID>
  <Description>Type in a description for this Add-in.</Description>
  <Version>1.0</Version>
  <Image>Images\ArcMapAddin1.png</Image>
  <Author>Kirk</Author>
  <Company>AmberGIS</Company>
  <Date>4/11/2011</Date>
  <Targets>
    <Target name="Desktop" version="10.0" />
  </Targets>
  <AddIn language="CLR" library="ArcMapAddin1.dll" namespace="ArcMapAddin1">
    <ArcMap>
      <Menus>
        <Menu isRootMenu="true" id="MyRootMenu" caption="RootMenu">
          <Items>
            <Button refID="AmberGIS_ArcMapAddin1_Button1"/>
          </Items>
        </Menu>
      </Menus>
      <Commands>
        <Button id="AmberGIS_ArcMapAddin1_Button1" class="Button1" message="Add-in command generated by Visual Studio project wizard." caption="My Button" tip="Add-in command tooltip." category="Add-In Controls" image="Images\Button1.png" />
      </Commands>
    </ArcMap>
  </AddIn>
</ESRI.Configuration>

I then ran in debug mode, which brought up arcmap. Under Customize>Customize Mode, I went to Commands tab and was able to drag and drop RootMenu onto the main menu.

enter image description here

After closing, it was still there.

enter image description here

share|improve this answer
    
Thank you, Kirk. Your example helped in knowing that I was close. The specific problem was that internal static string in the config.designer.cs kept putting in the fully qualified string. Taking out the namespace (as well as simplifying it) was the solution. –  SteveC Apr 11 '11 at 19:18
    
Did you change your xml file, or from the cs file? The cs file is auto generated, so I wouldn't rely on edits made there. –  Kirk Kuykendall Apr 12 '11 at 13:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.