Build your first add-in

This tutorial demonstrates how to create and run a basic ArcGIS Pro add-in.

With the ArcGIS Pro SDK for .NET, you can extend ArcGIS Pro with your own unique tools and workflows. Using Microsoft Visual Studio and the Pro SDK, developers can build Pro add-ins and solution configurations that provide users with custom functionality specific to their organization or industry. Add-ins can be developed and tailored to your specific users’ needs; for example, providing a new custom spatial analysis processing routine which leverages a custom dataset, or create a new set of Pro tools that streamline a complex editing workflow.

This tutorial is an introduction to developing ArcGIS Pro add-ins. You will use C# to create a new button which returns the current project path on the ArcGIS Pro UI.

Prerequisites

Steps

Create a new ArcGIS Pro Add-In Visual Studio Project

  1. Start Visual Studio.

  2. Choose File > New > Project and then from ArcGIS templates group, select ArcGIS Pro Module Add-in.

  3. Compile and build the project.

  4. From Windows Explorer, navigate to C:\Users\<Your user name>\Documents\ArcGIS\AddIns\ArcGISPro. You should see the add-in folder for your newly compiled add-in. Double-click the folder to find your add-in file within the folder, reflecting the name of your project with an .esriAddinX extension. The name of the folder corresponds to the ID (GUID) of your add-in as found in your Config.daml file.

Create a new button using a Pro SDK template

  1. If your project is running, stop it. In the Solution Explorer, right-click the project and choose Add > New Item and then from the ArcGIS Pro Add-ins group select ArcGIS Pro Button from the list of item templates.

  2. Use the default name of Button1.cs for the new class file and press Add to close the dialog box.

  3. Type the following code into the existing OnClick method.

    Use dark colors for code blocksCopy
    1
    2
     string stringURI = ArcGIS.Desktop.Core.Project.Current.URI;
     ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show($"Project path:  {stringURI}", "Project Info");
  4. Compile and build the add-in project.

Run the project

  1. Place a breakpoint in the margin of the stringURI variable declaration, and then press Start to run the add-in project in the Visual Studio debugger. ArcGIS Pro will start and show the start page.

  2. From the start page, create a new empty project using a template of your choice or open an existing project. If creating a new project, specify a name and location of your choice.

  3. Once the project opens, click the Add-In tab. Click your new button, named Button1, which used the default name of your button class. Your breakpoint will be hit in Visual Studio which you can review in your code.

  4. Press F5 or Continue to continue execution. The message box should display with the project path. Press OK to close the message box.

  5. Press Stop Debugging in Visual Studio, which will close ArcGIS Pro.

What's next?

Learn how to use additional ArcGIS Pro SDK for .NET features in these tutorials:

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.