Overview

You will learn: how to create add-ins with control over add-in loading, which can be very helpful in multiple add-in deployments.

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 configurations that provide users with custom functionality specific to their organization or industry.

The Pro SDK’s Desktop Application Markup Language (DAML) provides functionality you can use to manage add-in loading. It can be beneficial at times to separate the Pro SDK customizations you’ve developed into more than one add-in. For example, when you want to enhance the capabilities of an existing add-in or are incrementally releasing functionality across a set of add-ins. This tutorial will walk you through creation of two add-ins which will work together with dependencies for their UI aspects, leveraging the capabilities of DAML.

Steps

Create a new add-in solution with a simple button

  1. Start Visual Studio.

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

Add a button control to your add-in

  1. 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. When prompted, use the default name of Button1.cs and press Add to close the dialog box. The Button template provides the contents of the class file, as well as corresponding code in the Config.daml file for the Pro UI.

    Add the following code to the OnClick method of Button1:

        ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Add-in 1's Button here!", "Info");
    
  2. Update the Config.daml file AddInInfo section so that the DAML appears as follows:

    </AddInInfo>
    <!-- ** ADD ** -->
    <modules>
        <insertModule id="LoadFirstAddin_Module" className="Module1" autoLoad="false" caption="Module1">
        <tabs>
            <tab id="LoadFirstAddin_Tab1" caption="Loading Test">
            <group refID="LoadFirstAddin_Group1"/>
            </tab>
        </tabs>
        <groups>
            <group id="LoadFirstAddin_Group1" caption="Add-in 1 Group" appearsOnAddInTab="false">
            <button refID="LoadFirstAddin_Button1" size="large" />
            </group>
        </groups>
        <controls>
            <button id="LoadFirstAddin_Button1" caption="Add-in 1 Button" className="Button1" loadOnClick="true"
                    smallImage="Images\GenericButtonBlue16.png" largeImage="Images\GenericButtonBlue32.png">
            <tooltip heading="Tooltip Heading">Tooltip text<disabledText /></tooltip>
            </button>
        </controls>
        </insertModule>
    </modules>
    

Build and test LoadFirstAddin

  1. Build your project and debug any issues. Start the project which will launch ArcGIS Pro. Create a new project or open an existing project when the start page appears.

    • Click on the new Add-In tab called Loading Test and find your new button with the Add-in 1 Button caption. Press the button to make sure that the message box is working.

    • If everything is working properly, then you are now ready to build your second add-in which will integrate with LoadFirstAddin and place a new button in the same control group your first add-in.

    • Save your project and close Visual Studio.

Create a new add-in, LoadSecondAddin

  1. Start Visual Studio.

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

Add a button control to your second add-in

  1. 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. When prompted, name the class Button2.cs and press Add to close the dialog box. The Button template provides the contents of the class file, as well as corresponding code in the Config.daml file for the Pro UI.

    Add the following code to the OnClick method of Button2:

        ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Add-in 2's Button here!", "Info");
    
  2. Update the Config.daml file AddInInfo section so that the DAML appears as follows:

    </AddInInfo>
    <!-- ** ADD ** -->
    
    <dependencies>
        <dependency name="{160a431f-710d-4e40-b971-cc4018579663}"/>
    </dependencies>
    
    <modules>
        <insertModule id="LoadSecondAddin_Module" className="Module1" autoLoad="false" caption="Module1">
        <controls>
            <!-- add your controls here -->
            <button id="LoadSecondAddin_Button2" caption="Add-in 2 Button" className="Button2" loadOnClick="true" smallImage="Images\GenericButtonBlue16.png" largeImage="Images\GenericButtonBlue32.png">
            <tooltip heading="Tooltip Heading">Tooltip text<disabledText/></tooltip>
            </button>
        </controls>
        </insertModule>
        <updateModule refID="LoadFirstAddin_Module">
        <groups>
            <updateGroup refID="LoadFirstAddin_Group1">
            <insertButton refID="LoadSecondAddin_Button2"/>
            </updateGroup>
        </groups>
        </updateModule>
    </modules>
    

Build and test LoadSecondAddin

  1. Build your project and debug any issues. Start the project which will launch ArcGIS Pro. Create a new project or open an existing project when the start page appears.

    • Click on the Add-In tab called Loading Test which should be loaded from the earlier steps.

    • Confirm that your new LoadSecondAddin button with the Add-in 2 Button caption is loaded to the right of Add-in 1 Button in the same Add-in 1 group.

    • Press the button to make sure that the message box is working.

Congratulations, you're done!

Compare your solution with our completed solution project.

Challenge

Review the online documentation

Read more about Add-in loading in the document ProConcepts Advanced Topics.

Try a community sample

Try some of the Framework topic community samples on GitHub.