-
Notifications
You must be signed in to change notification settings - Fork 117
ProGuide Build your first add in
This guide demonstrates how to build an ArcGIS Pro add-in.
Language: C#
Subject: Framework
Contributor: ArcGIS Pro SDK Team <arcgisprosdk@esri.com>
Organization: Esri, http://www.esri.com
Date: 07/15/2015
ArcGIS Pro: 1.1
Visual Studio: 2013, 2015
Step 1
Open Visual Studio and select New Project.
![New Project](http://Esri.github.io/arcgis-pro-sdk/images/How to Build an Add-in with the ArcGIS Pro SDK for .NET/new-project.png "New Project")
Step 2
On the New Project dialog box, expand the Templates\Visual C#\ArcGIS or Templates\Visual Basic\ArcGIS folder. Select the ArcGIS Pro Add-ins folder (you may have other folders there if you also have the ArcObjects 10.x SDK for .NET installed).
Step 3
The ArcGIS Pro Module Add-in Visual Studio project item template displays. Select it and type ProAppModule for the name. Change the location or accept the default. Click OK.
![pro-app-module](http://Esri.github.io/arcgis-pro-sdk/images/How to Build an Add-in with the ArcGIS Pro SDK for .NET/pro-app-module.png "Module")
Step 4
Visual Studio creates a new Visual C# or Visual Basic project for you. For the purposes of this document, Visual C# will be assumed; however, the procedure is almost identical for Visual Basic. You will notice the following content in your new project:
![project-content](http://Esri.github.io/arcgis-pro-sdk/images/How to Build an Add-in with the ArcGIS Pro SDK for .NET/project-content.png "Add-in Project content")
The Config.daml file opens (by default) in Visual Studio. The Module1.cs file contains your add-in module code. The code will be similar to this:
internalclassModule1 : Module {
private static Module1 _this = null;
/// <summary>
/// Retrieve the singleton instance to this module here
/// </summary>
publicstaticModule1 Current {
get
{
return _this ?? (_this = (Module1)FrameworkApplication.FindModule("ProAppModule_Module"));
}
}
}
Note that the module contains a private reference to your module instance, which is a singleton. The string ProAppModule_Module is your module ID. Framework uses this ID to reference your module in the DAML file and to find your associated module instance in the FindModule method of the FrameworkApplication module. By default, your module class is called Module1. The default namespace is the name you entered on the New Project dialog box, which in this case, is ProAppModule.
Note also in the Config.daml file that the id attribute of the insertModule tag matches the ID within the Module1.cs file and the className attribute also matches the class name of the module.
<modules>
<insertModule id="ProAppModule_Module" className="Module1" autoLoad="false" caption="Module1">
Step 5
Compile and build the project. If you have errors in your output window, check that you have the ArcGIS Pro application and the ArcGIS Pro SDK for .NET correctly installed. As long as you have not changed the syntax in any of the generated files (from the Project template), there should be no compilation errors.
Step 6
Open Windows Explorer. Navigate to the C:\Users\<Your user name>\Documents\ArcGIS\AddIns\ArcGISPro
folder. You should see the add-in folder for your newly compiled add-in. The name of the folder corresponds to the ID (GUID) of your add-in.
<AddInInfo id="{c1968fdf-0368-45a2-8fa5-4f079c016b53}" ...
Double-click the folder. You will see your add-in file within the folder.
![guid-folder](http://Esri.github.io/arcgis-pro-sdk/images/How to Build an Add-in with the ArcGIS Pro SDK for .NET/guid-folder.png "Add-in guid")
Step 7 Right-click the project title within Visual Studio and select Add > New Item from the Project Context menu.
![new-item](http://Esri.github.io/arcgis-pro-sdk/images/How to Build an Add-in with the ArcGIS Pro SDK for .NET/new-item.png "Add new item")
From the Visual Studio Add New Item dialog box, choose ArcGIS Pro Button from the list of available ArcGIS Pro SDK Item templates. Keep the default name Button1.cs and click OK.
![item-templates.png](http://Esri.github.io/arcgis-pro-sdk/images/How to Build an Add-in with the ArcGIS Pro SDK for .NET/item-templates.png "Item template")
Step 8
Within Visual Studio you should now see a new file, Button1.cs, that has been added to your project. Double-click that file and type the following code into the OnClick method:
internalclassButton1 : Button {
protectedoverridevoid OnClick()
{
string uri = ArcGIS.Desktop.Core.Project.Current.URI;
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(string.Format("Project uri {0}", uri));
}
}
Step 9
Build and compile your add-in.
Step 10
Place a breakpoint in the margin of your OnClick method and run your add-in in the Visual Studio debugger.
![debug](http://Esri.github.io/arcgis-pro-sdk/images/How to Build an Add-in with the ArcGIS Pro SDK for .NET/debug.png "Break point")
Step 11
ArcGIS Pro starts. Log in with your Organization ID when prompted, and allow ArcGIS Pro to complete its initialization. Create a new empty project using the template of your choice or open one of your existing projects. ![new-pro-project](http://Esri.github.io/arcgis-pro-sdk/images/How to Build an Add-in with the ArcGIS Pro SDK for .NET/new-pro-project.png "New ArcGIS Pro Project")
Step 12
Click ADD-IN tab and click the Button 1 add-in button.
![add-in-tab](http://Esri.github.io/arcgis-pro-sdk/images/How to Build an Add-in with the ArcGIS Pro SDK for .NET/add-in-tab.png "Add-in tab")
![new-button](http://Esri.github.io/arcgis-pro-sdk/images/How to Build an Add-in with the ArcGIS Pro SDK for .NET/new-button.png "New button")
Step 14
Your breakpoint will be hit in Visual Studio. Press F5 or click the Continue button to continue execution. The following message box displays.
![code-break-point](http://Esri.github.io/arcgis-pro-sdk/images/How to Build an Add-in with the ArcGIS Pro SDK for .NET/code-break-point.png "Code break point") ![msg-box](http://Esri.github.io/arcgis-pro-sdk/images/How to Build an Add-in with the ArcGIS Pro SDK for .NET/msg-box.png "Message Box")
Click OK. Stop debugging.
Home | API Reference | Requirements | Download | Samples
- Overview of the ArcGIS Pro SDK
- What's New for Developers at 3.4
- Installing ArcGIS Pro SDK for .NET
- Release notes
- Resources
- Pro SDK Videos
- ProSnippets
- ArcGIS Pro API
- ProGuide: ArcGIS Pro Extensions NuGet
Migration
- ProSnippets: Framework
- ProSnippets: DAML
- ProConcepts: Framework
- ProConcepts: Asynchronous Programming in ArcGIS Pro
- ProConcepts: Advanced topics
- ProGuide: Custom settings
- ProGuide: Command line switches for ArcGISPro.exe
- ProGuide: Reusing ArcGIS Pro Commands
- ProGuide: Licensing
- ProGuide: Digital signatures
- ProGuide: Command Search
- ProGuide: Keyboard shortcuts
Add-ins
- ProGuide: Installation and Upgrade
- ProGuide: Your first add-in
- ProGuide: ArcGIS AllSource Project Template
- ProConcepts: Localization
- ProGuide: Content and Image Resources
- ProGuide: Embedding Toolboxes
- ProGuide: Diagnosing ArcGIS Pro Add-ins
- ProGuide: Regression Testing
Configurations
Customization
- ProGuide: The Ribbon, Tabs and Groups
- ProGuide: Buttons
- ProGuide: Label Controls
- ProGuide: Checkboxes
- ProGuide: Edit Boxes
- ProGuide: Combo Boxes
- ProGuide: Context Menus
- ProGuide: Palettes and Split Buttons
- ProGuide: Galleries
- ProGuide: Dockpanes
- ProGuide: Code Your Own States and Conditions
Styling
- ProSnippets: Content
- ProSnippets: Browse Dialog Filters
- ProConcepts: Project Content and Items
- ProConcepts: Custom Items
- ProGuide: Custom Items
- ProGuide: Custom browse dialog filters
- ArcGIS Pro TypeID Reference
- ProSnippets: Editing
- ProConcepts: Editing
- ProConcepts: COGO
- ProConcepts: Annotation Editing
- ProConcepts: Dimension Editing
- ProGuide: Editing Tool
- ProGuide: Sketch Tool With Halo
- ProGuide: Construction Tools with Options
- ProGuide: Annotation Construction Tools
- ProGuide: Annotation Editing Tools
- ProGuide: Knowledge Graph Construction Tools
- ProGuide: Templates
3D Analyst Data
Plugin Datasources
Topology
Linear Referencing
Object Model Diagram
- ProSnippets: Geometry
- ProSnippets: Geometry Engine
- ProConcepts: Geometry
- ProConcepts: Multipatches
- ProGuide: Building Multipatches
Relational Operations
- ProSnippets: Knowledge Graph
- ProConcepts: Knowledge Graph
- ProGuide: Knowledge Graph Construction Tools
Reports
- ProSnippets: Map Authoring
- ProSnippets: Annotation
- ProSnippets: Charts
- ProSnippets: Labeling
- ProSnippets: Renderers
- ProSnippets: Symbology
- ProSnippets: Text Symbols
- ProConcepts: Map Authoring
- ProConcepts: Annotation
- ProConcepts: Dimensions
- ProGuide: Tray buttons
- ProGuide: Custom Dictionary Style
- ProGuide: Geocoding
3D Analyst
CIM
Graphics
Scene
Stream
Voxel
- ProSnippets: Map Exploration
- ProSnippets: Custom Pane with Contents
- ProConcepts: Map Exploration
- ProGuide: Map Pane Impersonation
- ProGuide: TableControl
Map Tools
- ProGuide: Feature Selection
- ProGuide: Identify
- ProGuide: MapView Interaction
- ProGuide: Embeddable Controls
- ProGuide: Custom Pop-ups
- ProGuide: Dynamic Pop-up Menu
Network Diagrams
- ArcGIS Pro API Reference Guide
- ArcGIS Pro SDK (pro.arcgis.com)
- arcgis-pro-sdk-community-samples
- ArcGISPro Registry Keys
- ArcGIS Pro DAML ID Reference
- ArcGIS Pro Icon Reference
- ArcGIS Pro TypeID Reference
- ProConcepts: Distributing Add-Ins Online
- ProConcepts: Migrating to ArcGIS Pro
- FAQ
- Archived ArcGIS Pro API Reference Guides
- Dev Summit Tech Sessions