Creating a Simple ArcGIS Extension
For those that need to develop 9.2 ESRI extensions on the cheap, here’s a distilled version of what you will need to do:
0) make sure ArcGIS 9.2 has .Net support installed
1) install Visual Studio Express (C#, VB.NET, J# flavors available).
2) create a new project (use the dll project template), make sure to reference all the favorite ESRI libraries in the project.
3) change the setting for the project that deals with “COM Visibility,” make sure you set this to true/checked, or you’ll never get your dll to work.
4) create a new class, for this example, implement the “ICommand” interface.
5) right before the class declaration, inside the namespace declaration, add AT LEAST this attribute:
[Guid(“*your unique guid here*”)]
(generate your own GUIDs here: http://kruithof.xs4all.nl/uuid/uuidgen)
on the next line, it’s nice to add a unique program id
6) for the class declaration, make sure to add the PUBLIC keyword, this is missing from the pregenerated class declaration, it’s in the ESRI examples, but not stated explicitly. I didn’t notice for a long time, and could never figure out why my extensions wouldn’t load. If you are a student of COM Interop, you probably already knew this…
7) IN the class body, add the COM register and unregister functions (these are documented well by ESRI, so go do your homework).
8) compile the dll.
9) copy the compiled dll (and any library dependancies not in the .Net GAC) to the ArcGIS/bin directory (probably c:\program files\arcgis\bin)
10) run cmd, cd to the bin directory used in step 9.
11) run c:\windows\microsoft.net\framework\v2.*xxxxx*\regasm.exe *your fancy dll*.dll, this should give some positive feedback like “Assembly Registered Successfully” or something to that effect.
12) load the ArcGIS app that you built the tool for.. use the customize dialog to add the tool to the menu of your choice (for context menus, you can show the “Context Menus” toolbar and drag your command to it.)
13) Run Command