Using ArcMap Addins In a Standalone Application

751
4
02-10-2013 02:15 AM
DonParker
New Contributor
Using ArcObjects, I've developed several Addins for use within the ArcMap for Desktop (Basic) application.  But now I would like to use some of these same Addins in a Standalone application.  How do I do that, or is it even possible?

Thanks,
Don
0 Kudos
4 Replies
RichardWatson
Frequent Contributor
I doubt that you can use them directly.

ArcObjects can be accessed in several different contexts including ArcMap, ArcEngine, or ArcGIS Server.  The way that you inject custom business logic into each of contexts is different.

What you can do is split your add-in such that you can use the heart of your business logic regardless of context.  You then develop a small, context specific, layer on top of that which allows you to inject your logic.
0 Kudos
LeoDonahue
Occasional Contributor III
What you can do is split your add-in such that you can use the heart of your business logic regardless of context.

I'll second that.

All of your business logic for add-ins should be in your model.

Example, if you write some code for fetching the layer name from the TOC by layer name, that code should not be located in a GUI, or a controller object.  But if you use that code in other projects, consider making a utility class and storing some "common to all kinds of applications" code in it. Other examples would be code for converting screen coordinates to map coordinates, etc.
0 Kudos
DuncanHornby
MVP Notable Contributor
Don,

Not sure about AddIns being used in other applications but if you wanted to say have Access drive ArcMap or use your custom ArcObjects in Excel you want to be creating a Class Library under the extending ArcObjects when you create a new Visual Studio project. If it were me I would then develop my Code as a COM Class. The compiled DLL can then be added to the application under the reference section in the VBA editor and then all you code will appear.

Duncan
0 Kudos
SiqiLi
by Esri Contributor
Esri Contributor
ArcGIS Desktop Add-ins can only be used in Desktop products including ArcMap, ArcCatalog, ArcScene, or ArcGloble.  They cannot be used in ArcGIS Engine application.

If you want to create a tool which can be used in a standalone ArcGIS Engine application, you need to go with the COM-based component implementing ICommand or ITool. The following documentation shows how to do it.
http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/#/Creating_commands_and_tools/0001...

When you create a COM-based component, you can choose to create a "Universal Tool" which can be used in Engine app. Please see the following screen shot of my "ArcGIS New Item Wizard Options" dialog.
[ATTACH=CONFIG]21841[/ATTACH]
0 Kudos