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:
- 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.