-
Notifications
You must be signed in to change notification settings - Fork 120
ProConcepts CoreHost
This topic provides a brief introduction to building stand-alone apps with the ArcGIS Pro ArcGIS.CoreHost and ArcGIS.Core assemblies.
ArcGIS.CoreHost.dll
ArcGIS.Core.dll
Language: C#
Subject: CoreHost
Contributor: ArcGIS Pro SDK Team <arcgisprosdk@esri.com>
Organization: Esri, http://www.esri.com
Date: 10/06/2024
ArcGIS Pro: 3.4
Visual Studio: 2022
ArcGIS.Core.dll provides 64-bit access to the Geodatabase and Geometry classes used by ArcGIS Pro. This assembly can be referenced in either an ArcGIS Pro Add-in or embedded in a console or WPF app. Unlike in an add-in, when ArcGIS.Core.dll is used in a console app (or WPF app), you must first initialize the underlying environment by calling the static Host.Initialize
method on the ArcGIS.Core.Hosting.Host
class located in the ArcGIS.CoreHost assembly. After initialization, any of the ArcGIS.Core.dll types can be constructed and accessed. (Note: Attempting to access any of the ArcGIS Pro UI elements or types in other assemblies in an ArcEngine-like fashion will crash your program).
This topic walks you through the procedure for configuring your app to run ArcGIS.Core external to the ArcGIS Pro Add-in framework.
- ArcGIS Pro must be installed on either the developer machine or the host machine on which your program will be run.
- You must configure your ArcGIS Pro license settings in one of the following ways:
- Single Use License
- Concurrent Use License
- Named User License --and--
- Either:
- Check the Authorize ArcGIS Pro to work offline check box on the Backstage tab --or--
- Check the Sign me in automatically check box on the ArcGIS Sign In pop-up.
Note: If you are using Single Use or Concurrent Use license mechanisms, you can configure Pro's licensing without a user interface (UI) by running the ArcGIS Pro setup program using Windows Installer command line parameters. Refer to the Install ArcGIS Pro silently documentation to configure Single Use or Concurrent use licenses for an un-attended option.
Backstage Authorize ArcGIS Pro to work offline
ArcGIS Sign In Sign me in automatically (for Named User License)
In Visual Studio, create a new console application. Add references to the following two DLLs, both located in the ArcGIS Pro bin folder:
- ArcGIS.CoreHost.dll
- ArcGIS.Core.dll
On the Build properties dialog box of your project, change the Platform Target combo box to be x64 (by default it will be Any CPU).
In your code, add the [STAThread]
attribute above the console's static Main(string[] args)
method. The presence of the STAThread
attribute forces the application's primary thread to initialize as an STA thread the first time the application does any interoperability work with COM (for example, via the first call to a type in ArcGIS.Core.dll).
Initialize the Host
class before accessing any types within the ArcGIS.Core assembly. To initialize the Host
class, call its static Initialize
method:
class Program {
//[STAThread] must be present on the Application entry point
[STAThread]
static void Main(string[] args) {
//Call Host.Initialize before constructing any objects from ArcGIS.Core
try {
Host.Initialize();
}
catch (Exception e) {
// Error (missing installation, no license, 64 bit mismatch, etc.)
Console.WriteLine(string.Format("Initialization failed: {0}",e.Message));
return;
}
There is no return value. If initialization is successful, program execution will continue, and ArcGIS.Core functionality can be accessed. If initialization fails, a System.Exception
will be thrown on the Initialize call.
Note: You do not need to call a shutdown method to unload the ArcGIS.Core assembly (similar to IAoInitialize.Shutdown
in ArcObjects).
Host.Initialize
checks:
- Is the Program 64 bit?
- Is the process COM threading model single-threaded apartment (STA)?
- Is ArcGIS Pro installed?
- Can ArcGIS Pro licensing be initialized? (See prerequisites)
Any failure in the initialization sequence will result in a System.Exception
. Check the returned message in the System.Exception
from Host.Initialize, and take the appropriate corrective action.
Automating ArcGIS Pro Mapping is supported in arcpy.mp. You can find more information in What is ArcPy?.
In order to edit datasets in a Geodatabase while running ArcGIS.Core external to the ArcGIS Pro Add-in framework, the ArcGIS.Core.Data namespace provides the Geodatabase.ApplyEdits method. See Editing in stand-alone mode for more details.
The prerequisites for deploying an executable taking advantage of ArcGIS.CoreHost.dll and ArcGIS.Core.dll are as follows:
- ArcGIS Pro must be installed on the host machine.
- The licensing prerequisites must be met when the program is run.
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