Select to view content in your preferred language

ArcGIS Pro CoreHost standalone Program Issue

202
2
3 weeks ago
gaofangwan
Emerging Contributor

Hi Everyone,

I installed ArcGIS Pro 3.5  and then created a program with "ArcGIS Pro CoreHost application" template in Visual Studio 2022, and  added  little number line of code to open a FileGDB after Host.Initialize().

When Debuging it, it throw exception: "Unhandled exception: System.DllNotFoundException: Unable to load DLL 'CoreInterop.dll' or one of its dependencies: The specified procedure could not be found. (0x8007007F)"

And I have check that "C:\Program Files\ArcGIS\Pro\bin" have been added to  the PATH System Environment Variable as here suggested.

 

gaofangwan_0-1751851965370.png

If anyone know why? Please tell me how to solve it , thanks.

0 Kudos
2 Replies
Aashis
by Esri Contributor
Esri Contributor

Are  ArcGIS.Core.dll & ArcGIS.CoreHost.dll set to `Copy Local: Yes`?

Aashis_0-1751898687369.png

If this doesn't work, please zip your project and post it in the thread so that we can download it for further investigation.

Wolf
by Esri Regular Contributor
Esri Regular Contributor

@Aashis is correct, but if you want to use the assemblies in your ArcGIS Pro / bin folder you can model your code using this sample:  arcgis-pro-sdk-community-samples/CoreHost/CoreHostResolveAssembly at master · Esri/arcgis-pro-sdk-co...

The sample is using this code snippet to resolve the assembly path when the assembly is being loaded:

// Resolve ArcGIS Pro assemblies.
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.AssemblyResolve += new ResolveEventHandler(ResolveProAssemblyPath);

// Perform all your CoreHost tasks (API calls) in a method
// instead of in the Main method (you can't use the PRO API from within Main):
try
{
  PerformCoreHostTask(args);
}
0 Kudos