Select to view content in your preferred language

ArcGIS.Desktop.Core.Geoprocessing in standalone ArcGIS Pro SDK app

3276
7
Jump to solution
02-25-2019 06:05 AM
SverkerNorlander
Esri Contributor

So, I am trying to create a standalone app with the Pro SDK to run a geoprocessing tool (Register with Geodatabase).
First of all, I call ArcGIS.Desktop.Core.Geoprocessing.Geoprocessing.MakeValueArray(object[] args)
This call fails with

"System.NullReferenceException: Object reference not set to an instance of an object".

I've debugged this to the FindModule function in ArcGIS.Desktop.Framework.Contracts.Module and it comes down to the code:

if (FrameworkApplication._this == null)
    return (ArcGIS.Desktop.Framework.Contracts.Module) null;

Which is always true in my standalone application. I guess that this means that MakeValueArray() does not work in standalone mode? Or can I create my own FrameworkApplication without starting ArcGIS Pro?

0 Kudos
1 Solution

Accepted Solutions
RichRuh
Esri Regular Contributor

Sverker,

CoreHost applications don't have access to any of the ArcGIS.Desktop assemblies.  To execute a geoprocessing tool, you have to shell out to an external process and call Python directly.

--Rich

View solution in original post

7 Replies
RichRuh
Esri Regular Contributor

Sverker,

CoreHost applications don't have access to any of the ArcGIS.Desktop assemblies.  To execute a geoprocessing tool, you have to shell out to an external process and call Python directly.

--Rich

SverkerNorlander
Esri Contributor

Thanks Rich!

That's what I thought and calling a python process was the solution I was thinking about using.

0 Kudos
philippenn
Regular Contributor

Not sure what the point is of CoreHost apps if they don't have access to basic functionality like invoking GP tools...is there any plan to extend the API to work with ArcGIS.Desktop assemblies? Also not sure how else to write Unit Tests without this ability...

RichRuh
Esri Regular Contributor

There are no plans that I am aware of.  Many customers are using CoreHost for data migration and similar applications.

--Rich

0 Kudos
AZendel
Frequent Contributor

Is this still the case with ArcGIS Pro 3.0? I have a stand alone vb.net exe that executes geoprocessing models using libraries/assemblies from ArcMap 10.8.1. Windows Task Scheduler wakes it up every hour and it also performs a lot of SQL tasks via native SQL Server client libraries.  It also calls a geoprocessing model that geocode addresses and later calls another geoprocessing model that appends those features to a feature class. Since ArcMap will not exist in the future, I'm trying to migrate it to rely on libraries from Pro.

Here's the VB.net / ArcObjects code:

        Dim parameters As ESRI.ArcGIS.esriSystem.IVariantArray = New ESRI.ArcGIS.esriSystem.VarArray
        Dim GP As esri.ArcGIS.Geoprocessing.IGeoProcessor2 = New esri.arcgis.Geoprocessing.Geoprocessor()
        'Add the BestPath toolbox.
        GP.AddToolbox("C:\path\to\my\toolbox.tbx")
        parameters.Add(sGDBPath & "\databasename.DBO.myfeatureclass")
        'Execute the model tool by name.
        GP.Execute("DeleteCountyStatusPermits", parameters, Nothing)

 

There's no way to do this on machines that have Pro and not ArcMap? It would be nice to not have to 'wrap' these models in python scripts - that adds too much complexity to maintaining my project. 

Thanks for your time,

 

Alex

0 Kudos
JamieKelly1
Frequent Contributor

I am trying to re-write older ArcObject (ArcGIS 10.8) to reproduce some background processing that updates a feature class by first deleting all the rows and then appending all new data from an interim in memory feature class.  I ran into a wall when trying to call the geoprocessing tools DeleteFeatures and Append - well actually it was the Geoprocessing.MakeValueArray() that failed.  Reading this, looks like it is not possible.  Not a good experience of "Upgrade", loosing functionality.

0 Kudos
JamieKelly1
Frequent Contributor

Actually, just found the deleteFeatures method on the table object - That's 1+ for improvement.  Maybe there is an Append or Copy features that I haven't found yet in the new API.  Sorry for the negative comments before about the new SDK.

0 Kudos