ProGuide ArcGIS AllSource Project Template - Esri/arcgis-pro-sdk GitHub Wiki

Language:      C#
Subject:       Framework
Contributor:   ArcGIS Pro SDK Team <[email protected]>
Organization:  Esri, http://www.esri.com
Date:          10/06/2024
ArcGIS Pro:    3.4
Visual Studio: 2022

Overview

As of release 3.3, the ArcGIS Pro SDK for .NET provides a project template for creating a module add-in for ArcGIS AllSource. This guide will walk you through the steps to create a new module add-in project for ArcGIS AllSource using this new project template.

Note: Configurations are not supported with ArcGIS AllSource.

In this topic

Create a new ArcGIS AllSource Add-in project

Prerequisite:

Before you can build an ArcGIS AllSource add-in, you must have ArcGIS AllSource 1.2+ installed along with the corresponding version of the ArcGIS Pro SDK on your development machine (version 3.3+). For details on how to install the ArcGIS Pro SDK you can follow the installation instructions in this ProGuide: Install ArcGIS Pro SDK for .NET.

Step 1

Open Visual Studio and select 'Create a New Project'.

Create a New Project

Step 2

On the 'Create a New Project' dialog, use the 'Project Types' dropdown to select 'ArcGIS AllSource SDK'. Make sure that the 'Languages' dropdown is set to 'C#' or to the 'All Languages' default. Select 'ArcGIS AllSource Add-in' as the Project Type and click 'Next'.

Select AllSource Add-in

Step 3

The 'Configure you new project/ArcGIS AllSource Add-in' dialog displays allowing you to override the default project name and the default project location. Change the default settings or accept the default. Click 'Create'.

Configure AllSource Add-in

Step 4

Visual Studio creates a new Visual C#. You will notice the following content in your new project:

NewAllSourceContent

The Config.daml file opens (by default) in Visual Studio. The content of an ArcGIS AllSource config.daml file is similar to the content of an ArcGIS Pro config.daml file. The Config.daml file contains the additional 'product' attribute under the AddInInfo tag:

NewAllSourceConfigDaml

Note that the module contains a private reference to your module instance, which is a singleton. The string "<your_app_name>_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 of your project.

Step 5

Compile and build the project. If you have errors in your output window, check that you have the ArcGIS AllSource 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

Next you can start to customize your ArcGIS AllSource Add-in. There is no difference in the customization of an AllSource or ArcGIS Pro Add-in. To customize your AllSource Add-in, you can follow the steps in the various Pro Guides available in the Pro SDK wiki TOC. For example: ProGuide Build your first add-in.

Convert an existing ArcGIS Pro Add-in project into an AllSource Add-in project and vice versa

Prerequisite:

The prerequisites for these steps are the same as for creating a new ArcGIS AllSource Add-in project. Assuming you have AllSource version 1.2 or better installed:

Either convert an existing ArcGIS Pro Add-in project into an AllSource Add-in project

As of release 3.3, a 'product' attribute, with a value of "ArcGISPro", was added to the<AddInInfo /> element in the Config.daml by the SDK addin project template and with a value of "ArcGISAllSource" for AllSource addins (by the AllSource addin project template). This attribute is optional for ArcGIS Pro Add-ins so if it is not present (as will be the case for all addins made prior to 3.3) then a value of "ArcGISPro" is always assumed. An AllSource Add-in, however, must always have a product attribute with a product="ArcGISAllSource" value assigned. As AllSource uses a different versioning scheme to Pro, the desktopVersion attribute must also be changed to reflect the correct version of AllSource being targeted.

For example, to change the Config.daml of these Pro addins to use AllSource....:

<AddInInfo id="{f..1}" version="1.0" 
             desktopVersion="3.2"> <!-- no product attribute, prior to 3.3 -->
             ...
</AddInInfo>

-- or -- 

<AddInInfo id="{f..1}" version="1.0" 
             desktopVersion="3.3" product="ArcGISPro"><!-- this has a product attribute -->
             ...
</AddInInfo>

Add the product="ArcGISAllSource" attribute to the <AddInInfo ... /> element (or change its value from "ArcGISPro" if there is one there already) and change the desktopVersion attribute to target the desired version of AllSource - v1.2 in this case, i.e. desktopVersion="1.2".

<AddInInfo id="{f..1}" version="1.0" 
             desktopVersion="1.2" product="ArcGISAllSource"><!-- note the desktopVersion -->
             ...
</AddInInfo>

After changing the Confog.daml, change the project references in Visual Studio to point to the AllSource product (or back to the ArcGIS Pro product depending on whether you are switching to or from AllSource). Simply right-click on the project in the Solution Explorer and select the ArcGIS Pro SDK 'Pro Fix References' tool. It works for both AllSource and Pro projects. This tool reads the "product" attribute. If the product attribute is set to "ArcGISAllSource", it fixes the references to point to AllSource. If the product attribute is missing or is set to "ArcGISPro", it fixes the references to point to Pro. You can install it as part of the ArcGIS Pro SDK for .NET utilities .vsix.

To check that the conversion was successful, compile and rebuild the project and validate the output.

To convert an AllSource Add-in back to an ArcGIS Pro Add-in

Perform the Config.daml update and 'Pro Fix References' steps above in reverse. In the Config.daml, either change the product attribute back to "ArcGISPro" or delete it entirely. Change the desktopVersion back to the relevant Pro version. Then run the ArcGIS Pro SDK 'Pro Fix References' tool.

<AddInInfo id="{f..1}" version="1.0" 
             desktopVersion="3.3" product="ArcGISPro"><!-- or delete the product attribute entirely-->
             ...
</AddInInfo>

Compile and rebuild the project and validate the output.

⚠️ **GitHub.com Fallback** ⚠️