Select to view content in your preferred language

Run ArcMap Application from .Net code

534
0
12-11-2023 08:09 AM
vsevgu
by
Emerging Contributor

Hello!

I want to run ArcMap from c# code and get a link to an extension(add-in) for ArcMap.
Then, I want to call the extension(add-in) method, wait for it to execute, and close ArcMap.

I do the following:

 

var doc = new MxDocumentClass();
var app = doc.Parent;
var iapp = app as IApplication;

var myExtClass = new ESRI.ArcGIS.esriSystem.UIDClass();
myExtClass.Value = "{666666d3-a999-55e5-777f-321321321326}";
var myExt = iapp.FindExtensionByCLSID(myExtClass);
...

 

But an error occurs during code execution: "new MxDocumentClass"
The error is:

 

err.png

If I run the ArcMap application manually, there is no error.

Version: ArcGis Desktop Basic 10.5.

Tell me, please, what could be the problem?

0 Kudos
0 Replies