esriaddinx file and class full names

2116
2
12-21-2011 06:02 AM
CarlQuirion
New Contributor
Hello,

I am developping 3 toolbars with multiple buttons and decided to have my buttons in different namespaces. I looked up the <AddIn>'s namespace parameter and the <Button>'s class documentation , before changing anything.

The <Button>'s class documentation states :
"If this class is not in the default library namespace specified on the root AddIn element, the class name must be the full name (namespace.className)"

However, if i enter any values with ".", the ArcGISAddInHostGenerator generates invalid Config.Designer.cs entries...

For exemple :

       internal class IDs {
           
            /// <summary>
            /// Returns 'TestNamespace_cmdTest', the id declared for Add-in Button class 'TestNamespace.cmdTest'
            /// </summary>
            internal static string TestNamespace.cmdTest {
                get {
                    return "TestNamespace_cmdTest";
                }
            }
       }

This yields the two following errors :

Error 1 The modifier 'static' is not valid for this item
Error 2 The modifier 'internal' is not valid for this item


Of course, i could go back to "everything in the same namespace" but id rather not, especially if this is documented as a supported feature...
Anything im doing wrong or is this a bug/wasn't tested ?

Thanks in advance

Edit, for reference, this would be the button entry in the Config.esriaddinx
    <Button id="TestNamespace_cmdTest"
      class="TestNamespace.cmdTest"
      message="Test"
      caption="Test"
      tip="Test"
      category="Test"
      image="Images\Test-64x64.png"
      onDemand="false"/>
0 Kudos
2 Replies
JeffreyHamblin
New Contributor III
I see the same behavior in the generated code and the subsequent error. However, try editing the line in the Config.Designer.cs file from:

internal static string TestNamespace.cmdTest {

to:

internal static string TestNamespaceCmdTest {

(just remove the dot, or change the name to something else appropriate)

Then do a rebuild and it should work.

Note: in the sample Addin that I tested this with, upon the first rebuild after I edited the static property name, the name was reset to the one with dots and the build failed again. After editing it again it seemed to stick for subsequent builds.
0 Kudos
RichWawrzonek
Occasional Contributor
I simply remove the namespace qualifications from the property names as Jeff pointed out to fix the problem.  Be aware that anything you do to modify the Config.esriaddinx file will undo these changes because the Config.Designer.cs is auto-generated. You'll have to delete the namespaces again and rebuild.
0 Kudos