Hi,
I'm creating an Add-in Application for ArcGIS Pro v2.9 using Visual Studio 2019 in C#.
How do I access the geoprocessing assemblies so I can execute them in my codes? I have the following code but I'm getting an error: "Unable to load DLL ArcGISVersion.dll. The specified module could not be found."
Here's my code snippet:
using ESRI.ArcGIS.Geoprocessor;
using ESRI.ArcGIS.DataManagementTools;
private void ConnectToSQLServerDb()
{
//Declares variables here...
//Initialize a geoprocessing object
Geoprocessor GP = new Geoprocessor();
CreateDatabaseConnection dbCon = new CreateDatabaseConnection();
try
{
//Specify parameters
dbCon.out_folder_path = outFolder;
dbCon.out_name = outName;
dbCon.database_platform = dbPlatform;
dbCon.instance = sqlInstance;
dbCon.database = dbName;
dbCon.account_authentication = "OPERATING_SYSTEM_AUTH";
//Execute tool
GP.OverwriteOutput = true;
GP.Execute(dbCon, null);
}
catch (Exception ex)
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Failed to reset table: " + ex.Message, "Error Message", MessageBoxButton.OK, MessageBoxImage.Error);
}
finally
{
GP = null;
dbCon = null;
}
}