Select to view content in your preferred language

Accessing Custom Tool From Within Released Add-In

333
3
Jump to solution
06-22-2023 12:22 PM
RussellSuter
New Contributor II

Hey All,

I have managed to create an add-in for ArcGIS Pro 3.1 that I'm ready to deploy to my user base.  My add-in calls a python GeoProcessing tool which is in my AddIn.esriAddinX file.  The problem is my code can't find it.  I ran across something awhile back that suggested I do something like this:

string here = System.IO.Directory.GetCurrentDirectory();
string script = System.IO.Path.Combine(here, @"Toolboxes\Tools.atbx\BuildGeoPackage");

This worked great while building and running the Debug configuration.  Now though, when building for Release, it doesn't work.  The "here" string references the user's Desktop folder but the add-in is in Documents\ArcGIS\AddIns\ArcGISPro\{uuid}\AddIn.esriAddinX.

How do I get the actual install folder and then once there how do I peek into the .esriAddinX file?

 

0 Kudos
1 Solution

Accepted Solutions
RussellSuter
New Contributor II

This appears to work for both Debug and Release:

string here = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

View solution in original post

0 Kudos
3 Replies
RichardDaniels
Regular Contributor
Suggest you place the code on a network share drive, thus you don't have to deploy the python code to every machine. Then the path would be \\myserver\mypythongcode\thecode.py
0 Kudos
RussellSuter
New Contributor II

That is a nice idea but, for a couple of reasons I won't go into here, I can't do that.

0 Kudos
RussellSuter
New Contributor II

This appears to work for both Debug and Release:

string here = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
0 Kudos