How to share a custom ArcMap command (DLL)
http://edndoc.esri.com/arcobjects/9.2/NET/33903846-919f-48b4-a4b1-ef97680ddb7b.htm
AssumptionsBefore proceeding, review the following assumptions:
Obtain the name category and captionDo the following to obtain the name category and caption of the deployable command:
Thewarning message will not impact the component registration, but when itis time to deploy your application in a commercial setting, considerstrongly typing your assemblies. For more information on how tostrongly type assemblies, see Create Strong Name Key Dialog Box on the MSDN Web site. If you use a strongly typed name you do not need to use the /codebase switch in the Regasm.exe utility. For more information on all of the options of the Regasm.exe utility by Microsoft see the MSDN article Assembly Registration Tool (Regasm.exe).Note: To open a command prompt in Microsoft Windows and use the Regasm.exe utility:
You should see your customization available in list of the particular ArcGIS component category.Thename DeployTest1.CommandDeployTest1 matches the name of the class inthe dropdown of the ArcGIS Component Category Registrar dialog in theVS2005 project on the DevelopmentPC as shown in the screen shot in Step 1 of the section Determine the Component Category.Add the new ArcMap command
Open ArcMap on the TargetPC and add your customization to the Graphical User Interface (GUI).
Inthe preceding screen shot, the category is CategoryDeployTest1 and thecommand is CaptionDeployTest1. This matches the code screen shot in Step 1 under the Obtain the name category and caption section.Thereare numerous options to consider when deploying an ArcObjects basedapplication. This topic only suggested one option to provide a generalworkflow. Ifyou need to have your customization be consumed by other 3rd partydevelopers (i.e. they will write custom applications against yourobjects you create), then you may also need to issue additional syntaxwith the Regasm.exe utility by using the /tlb switch to create andregister any COM .tlb files. This would enable other developers toconsume and extend your customization.
See Also:Deploying in-process components (DLLs)
How to register classes in COM component categories
About the ArcGIS Component Category Registrar dialog box
How to register .NET components with COM
Deploying EXEs
- Youhave created a Visual Studio 2005 (VS2005) project that has an ArcMapcommand using the integrated development environment (IDE) features ofthe ArcGIS Desktop software development kit (SDK) on a computercalled DevelopmentPC.
- The DevelopmentPC computer has a VS2005 project located at C:\DeployTest1 with the following file:
- C:\DeployTest1\bin\Debug\DeployTest1.dll
- Youwant to deploy your custom ArcMap command on another Windows basedcomputer with the .NET Framework installed named TargetPC, which hasArcMap installed but not VS2005.
- Yourdeployment is essentially a shrink-wrap type of customization. Otherdevelopers will not consume or extend your custom .dll via additionalprogramming.
- Determine the component category to be registered with ArcMap for your class
- Obtain the name category and caption of the deployable command
- Onthe DevelopmentPC computer, open your VS2005 DeployTest1project and click Project and Add Component Category menus. See thefollowing screen shot:
- Inthe ArcGIS Component Category Registrar dialog box, select theappropriate Class that has your customization and look for any checkedcategories. In this example, our customization is in theDeployTest1.CommandDeployTest1 class and the ArcMap Command is checked.Notice under the ArcMap Command Properties section is the Caption valueis ESRI MxCommands.

- Onthe DevelopmentPC computer, scan the code in the VS2005 project for theNew method to obtain the category and caption of the command. In thisexample, the command's category is CategoryDeployTest1 and the captionis CaptionDeployTest1. See the following screen shot:
- On the TargetPC, create a new directory and name it C:\deployment_test.
- Copy the necessary deployment files onto your target computer. Specifically, copy the files from the DevelopmentPC:
- Onthe TargetPC computer, use the Microsoft Regasm.exe utility (usinga Windows command prompt) to register the deployed files appropriatelywith the operating system. Do this by issuing the following syntax fromthe command prompt on the DeploymentPC:

- Click Start, Run, type cmd at the command prompt, then press Enter.
- Using DOScommands, navigate to the Microsoft .NET Framework installationlocation; for example, on Windows XP navigateto: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727; on Windows NTnavigate to: C:\WINNT\Microsoft.NET\Framework\v2.0.50727).
- On the TargetPC computer, use Windows Explorer to locate and start C:\Program Files\ArcGIS\bin\categories.exe.
- Navigateto the Component Object Model (COM) category group that yourcustomization should be registered with. In our example scroll down tothe ESRI MxCommands and expand the node as demonstrated in thefollowing screen shot:

- In ArcMap, click Tools and Customize.
- In the Customize dialog box, click the Commands tab. Scroll down and click CategoryDeployTest1 from the Categories list.
- Drag CaptionDeployTest1 onto the GUI to test the functionality.
