ArcGIS AddIn Development Exception--modifier ' static ' is not valid for this item

Source: Internet
Author: User

Modifier "Static" is not valid for this item,

Modifier ' internal ' is not valid for this item.

The exception pops up near the declaration of the relevant plug-in in the Config.Designer.CS file

Internal Static  Water_info_toolbar.attributebrushtool

Getreturn"[email protected]_water_info_toolbar_attributebrushtool"
}

In a similar statement, there are many exceptions where this modifier is invalid. This file is automatically generated when a new plugin is created by a wizard, and has not been modified. Before the debugging passed, recently because of a new tool, do not know what the problem, this exception occurs.

The exception does not appear for all similar statements, and there is no such exception for some statements that have shorter names. Such as

Internal Static string Splitbyattribute {                get  {                    return][email protected]_water _info_toolbar_splitbyattribute";                }            }

Note: Since the tool is written several times, then a toolbar has been made to put all the plug-ins, code in a solution, the solution contains a addin project, an auxiliary class project.

Simple functions are built directly into the project, such as the ChangePolygon2Word.cs plug-in (this class is more complex, most of the content is encapsulated in the Waterinfoassiter project, only can be called here), the other more complex involves more content, then a new folder, the relevant code, Forms, etc., are placed in a unified folder.

After comparison found that the exception here, all are put into the folder plug-ins, these plug-ins before the normal run, the reason is unknown.

Workaround: Rename.

(1) Change the longer name in the Config.Designer.CS file to short, such as Attributebrushtool,

Before the name Water_Info_Toolbar.AttributeBrushTool.AttributeBrushTool,

Water_info_toolbar is the project name,
Attributebrushtool is the folder name. These longer names are generated based on the location of the plug-in, and when you create a new plug-in name, only the Attributebrushtool is entered in the wizard

(2) Modify the configuration of the specific Config.esriaddinx file about the plugin, change the class to a short name, Water_info_ Toolbar.AttributeBrushTool.AttributeBrushTool to Attributebrushtool, here should be a class that points to a concrete implementation of the background logic

<tool id="[Email Protected]_water_info_toolbar_attributebrushtool" class="Attributebrushtool"Message=""caption="Property Brush"tip="The property brush. CTRL + Left, select the source to use to brush the properties, then select to modify the values in the table on the right. After that, click the feature that you want to brush properties"category="WATER_INFO_CONTROLS_LLC"Image="Images\attributebrushtool.png"Cursor="Images\attributebrushtool.cur"/>

(3) Modify the Water_info_toolbar.attributebrushtool namespace in the AttributeBrushTool.cs file, leaving only Water_info_toolbar. Save As you can

According to the above content modification, exception can be eliminated.

When a plugin contains some forms and a panel, it is also modified as described in the previous steps. Just need to modify the relevant code in the Panel.designer.cs more.

The above practice can solve the exception, the reason is unknown, have to know the master trouble to inform

ArcGIS AddIn Development Exception--modifier ' static ' is not valid for this item

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.