With ArcGIS 9 and the ArcGIS templates for Visual Studio 2005, one had the option of creating a universal item, that is, additional functionality in the form of a tool, command button, or extension that would work in ArcMap, ArcCatalog, ArcGlobe, and/or ArcScene. With ArcGIS 10, the templates do not include this option. One must choose to create an ArcMap, ArcCatalog, ArcScene, or ArcGlobe Add-In, and these choices are mutually exclusive. If separate projects are created for each application that the tool is to be accessible in, then the end user has to download and install a separate add-in file for each application. Not desirable. Therefore, my question was, "How do I create one *.esriAddIn file to install them all?" I would like to thank Chris Fox at Esri for showing me how to make this happen. It is actually very easy, so I wanted to share this with all of you as well. I am going to go through the steps for creating a button that works in ArcMap, ArcScene, and ArcCatalog. ArcGlobe functionality could be added as well with the same process.
Step 1: Create a New Project in Visual Studio, and choose one of the Add-In types. I started with ArcMap. Give the project a name, a location, and choose the appropriate .NET Framework.

Step 2: Fill in the ArcGIS Add-Ins Wizard dialog screens with the applicable properties, and select the Add-in Type. I chose a button. Then click Finish.

This creates a project with a Config.esriaddinx file with XML elements to match the properties entered in the Add-in Wizard. It also creates a class with the Class Name as entered on the second dialog screen above. I named mine UniversalAddInArcMap to denote that this is the class that will contain the code for ArcMap.

Step 3: Add the code to the ArcMap class. I added a simple message box to say "I work in ArcMap." At this point, I could build the project, and I would have a command button that I could add in to ArcMap. However, since I want a button for ArcScene and ArcCatalog as well, I'm not done yet.

Step 4: Create a new project, and choose ArcScene as the add-in type. Once again, give the project a name, a location, and choose the appropriate .NET Framework. The name and location are not important though, for we are going to copy items from this project and paste them into our universal add-in project that we are building.

Step 5: Fill in the ArcGIS Add-Ins Wizard dialog screens with the applicable properties, and select the Add-in Type. Screen 1 is not important, for none of these XML properties will be copied from the config file.

The screen 2 properties will be copied, so they should match what was entered for the first project. Of course they can always be edited later.

Step 6: Click Finish, and then open the Config.esriaddinx file for the ArcScene project. Copy the XML ArcScene element.

Step 7: Paste the ArcScene element into the Universal config file as shown below. Then edit the id property to match the name of the universal project and update the image property so that the path points to the command image in the current project.

Step 8: Copy the ArcScene class from the ArcScene project and paste it into the universal project.

Step 9: Add the code to the ArcScene class.

The universal project should now have a command button that works in ArcMap and one that works in ArcScene. The same steps can be followed to create a button that will work in ArcCatalog (or in ArcGlobe). The config file for a project containing buttons for ArcMap, ArcCatalog, and ArcScene should be similar to the one shown below.

The ArcCatalog class would then need to be copied and pasted and the code edited.

Step 10: Once the config file is updated and the functionality is added to each of the individual classes, the project is ready to be built.

This creates a *.esriAddIn file that can optionally be signed with a code signing certificate applied by the ESRI Sign Add-In Utility.

This file can then be distributed to users who only need to double-click on the file to install the add-in. No administrative priviledges required!!! 

Once installed, the add-in command can be dragged and dropped onto any toolbar through the Customize dialog box in each application.

The command button is now ready to be used. Success!!! One file installs them all.

Hope this helps, and let me know if you have any questions,
Leslie
Recent comments