Manage Pro Add-In Loading

This tutorial demonstrates how to create add-ins that control add-in loading, which assists with 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 solution configurations that provide users with custom functionality specific to their organization or industry.

The ArcGIS Pro uses DAML to manage add-in loading. You might find it beneficial at times to separate your ArcGIS Pro SDK customizations into more than one add-in. For example, if you want to incrementally release add-in functionality across a set of enhancements, or are gradually enhancing the capabilities of an existing add-in.

In this tutorial, you will create two add-ins that work together with dependencies for their UI aspects, leveraging DAML capabilities.

Prerequisites

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 Button1.cs and click 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:

    Use dark colors for code blocksCopy
    1
        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:

    Use dark colors for code blocksCopy
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    </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="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonBlue16.png" largeImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/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 launches 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 works properly, you are now ready to build your second add-in which integrates with LoadFirstAddin and place a new button in the same control group with 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.

  2. 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 a corresponding code in the Config.daml file for the Pro UI.

    Add the following code to the OnClick method of Button2:

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

    • In the LoadSecondAddin DAML code above, take note of the updates that were referenced when you updated the Config.daml for the earlier LoadFirstAddin.

    • There is a new dependencies section included here. The dependency name references the GUID of LoadFirstAddin. This ensures that LoadFirstAddin is required to be loaded first.

    • There is a new updateModule section, which references the insertModule id and group id from LoadFirstAddin.

    Use dark colors for code blocksCopy
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    </AddInInfo>
    <!-- ** ADD ** -->
    
    <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="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonBlue16.png" largeImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/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 the Add-in 1 Button in the same Add-in 1 group.

    • Press the button to ensure that the message box functions as expected.

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.