POST
|
@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-community-samples 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);
}
... View more
07-30-2025
12:03 PM
|
0
|
0
|
633
|
POST
|
I don't see another way, however, i think processing will be fast since the layer data is cached in memory. Here is my sample: 3141 records in 0.017 seconds. These are the code changes to measure the timing: // count rows in each feature layer
StringBuilder result = new StringBuilder();
await QueuedTask.Run(() =>
{
foreach (FeatureLayer layer in featureLayers)
{
// Get the row count for the feature layer
// this is not working since it is getting the underlying table (which has all records in
// the case where a layer is created with a 'select' clause
// long rowCount = layer.GetTable().GetCount();
// create a cursor for the layer (not the table)
var rowCursor = layer.Search();
long rowCount = 0;
var timer = new Stopwatch();
timer.Start();
while (rowCursor.MoveNext())
{
rowCount++;
}
timer.Stop();
var elapsedTime = timer.Elapsed;
result.AppendLine($"{layer.Name}: {rowCount} rows {elapsedTime:m\\:ss\\.fff} min.");
}
});
// Show the result in a message box
MessageBox.Show(result.ToString(), "Row Count Results", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information);
... View more
07-14-2025
02:08 PM
|
1
|
1
|
678
|
POST
|
I doubt that this is a problem with access to the 'Assembly cache' folder - Actually when you register your esriAddinX file it will get unzipped in that folder using your user credentials and consequently it might not be the script folder itself, but instead it might be a reference to another file from within the script. There are some Microsoft tools that you can use to check which file (or folder) is the cause of this 'access denied' error: Search for Microsoft's SysinternalsSuite which is a collection of useful Windows tools. One of the tools is called ProcMon64.exe (for 'Process Monitor) and this tool allows you to capture any file i/o events and the cause of potential errors: You can use this tool (running on the machine where the problem occurs) to see which file (access) is causing the issue.
... View more
07-10-2025
06:56 PM
|
0
|
0
|
622
|
POST
|
If you select all features in the newly created layer you can use GetSelection () and the selection count on the layer, otherwise you have to use a RowCursor on the FeatureLayer itself (not on the underlying FeatureClass or Table): try
{
// get all feature layers in the current map
var map = MapView.Active.Map;
if (map == null)
{
MessageBox.Show("No active map found.", "Error", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
return;
}
var featureLayers = map.GetLayersAsFlattenedList().OfType<FeatureLayer>().ToList();
if (featureLayers.Count == 0)
{
MessageBox.Show("No feature layers found in the active map.", "Information", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information);
return;
}
// count rows in each feature layer
StringBuilder result = new StringBuilder();
await QueuedTask.Run(() =>
{
foreach (FeatureLayer layer in featureLayers)
{
// Get the row count for the feature layer
// this is not working since it is getting the underlying table (which has all records in
// the case where a layer is created with a 'select' clause
// long rowCount = layer.GetTable().GetCount();
// create a cursor for the layer (not the table)
var rowCursor = layer.Search();
long rowCount = 0;
while (rowCursor.MoveNext())
{
rowCount++;
}
result.AppendLine($"{layer.Name}: {rowCount} rows");
}
});
// Show the result in a message box
MessageBox.Show(result.ToString(), "Row Count Results", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information);
}
catch (Exception ex)
{
MessageBox.Show($"An error occurred: {ex.Message}", "Error", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
}
... View more
07-10-2025
08:24 AM
|
0
|
1
|
708
|
POST
|
The ArcGIS Pro SDK community samples repo contains an example of two Add-ins interfacing. Under the Framework folder you'll find AddInOne and AddInTwo and the shared component AddInShared. If you have a reusable versioned class library, you'll have to sign the add-in (and library) as @SelimDissem said above. If you just want to 'share' common source code between your two Add-ins you can also add a reference to your 'shared' CS source code as shown here (in which case, you don't need to worry about DLL versions):
... View more
07-09-2025
12:13 PM
|
1
|
1
|
975
|
POST
|
Your approach to move your source code to a previous release version of ArcGIS Pro is correct: You have to move the source code to a development machine with ArcGIS Pro 3.1 installed. You also have to install the matching ArcGIS Pro SDK (3.1 in your case) Visual Studio extensions. You open your Add-in solution in Visual Studio and change the project's 'Target Framework' back to .NET 6.0, clean the project, and then rebuild the project. Use the ArcGIS Pro SDK's 'Pro Fix References' tool (right click on the solution or project file) if the reference path to ArcGIS Pro assemblies changed. It is possible that you get errors when you rebuild the add-in. Errors can be caused by functionality added by .NET 8.0 (in my test i noticed that the '[]' collection expression is not valid in .NET 6.0) and errors can be caused by functionality added by an ArcGIS Pro release. In my test (i downgraded from 3.5 to 3.2) and i didn't get any errors by non-existing functions or assemblies of ArcGIS Pro 3.2. But you can get errors (like your "KnowledgeGraph" depended assembly that were caused by additions to future ArcGIS Pro releases. Once your Add-in builds under the older ArcGIS Pro release you have to update the desktopVersion attribute in the config.daml file to reflect the minimum required version you want your add-in to work with. See here: ProConcepts Advanced Topics · Esri/arcgis-pro-sdk Wiki "Add-ins and configurations are forwards compatible across all minor versions of ArcGIS Pro. Add-ins and configurations are not forward compatible across major versions (eg 2.x, 3.x, etc). Add-ins and configurations are not backwards compatible across any versions of ArcGIS Pro." Regarding the changes in each release can find the 'What's new' for all editions here: Home · Esri/arcgis-pro-sdk Wiki
... View more
06-23-2025
03:23 PM
|
2
|
1
|
385
|
POST
|
You didn't share your tool's OnSketchComplete method. Is it possible that it contains code to create an annotation feature? If you create a Construction Tool from the ArcGIS Pro SDK item templates you notice that this code is inserted with the template: // Create an edit operation
var createOperation = new EditOperation();
createOperation.Name = string.Format("Create {0}", CurrentTemplate.Layer.Name);
createOperation.SelectNewFeatures = true;
// Queue feature creation
createOperation.Create(CurrentTemplate, geometry);
// Execute the operation
return createOperation.ExecuteAsync(); this snippet will actually create an annotation feature using the current template (which usually has the string 'Text' as the default value): My guess is that only a 'Create' call on an EditOperation that is using the current template will produce your 'Text' annotation entry. Also, if you get the text for the annotation feature from a Query Cursor make sure to 'copy' the text string when you retrieve the string from your current feature. I would do the same if you get the geometry via a feature cursor, make sure to .Clone() the geometry.
... View more
06-17-2025
07:48 AM
|
0
|
0
|
700
|
POST
|
The 'Text' string you're seeing is coming from the annotation editing template. Somehow, there must be an extra 'createOperation.Create' function call that adds the default template settings to the annotation feature class. I wrote a sample add-in which is an annotation tool that allows you to select a set of point features (cities in my sample) via rectangular selection and then creates annotation features for all selected point features. I attached the sample code and also the project file i used for testing. Maybe you can compare the sample code to your code and find the difference. I tested my addin in both 3.4 and 3.5. To use the sample, open the attached SampleAnno.aprx, use the Create Features dockpane to select the 'Retrofit Annotation for points' tool and rubber band select a few cities to create the matching annotation strings.
... View more
06-16-2025
09:18 AM
|
0
|
1
|
735
|
POST
|
I tried this Addin using ArcGIS Pro 3.4 and i see the .lock files in 3.4 as well. As far as i can tell, the geodatabase connection must still be open. I think the same happens when you use the Catalog dockpane and manually open the Geodatabase: a .lock file is created and stays until you close Pro. I don't see a change in behavior between 3.4 and 3.5.
... View more
06-06-2025
11:55 AM
|
1
|
0
|
563
|
POST
|
I made a small sample add-in that imports a csv (included as add-in content) and adds the data into a new feature class in your project's default geodatabase. To run the add-in start with a new [empty] map [template] and open the 'FGB Importer' tab. Click the 'Show FGB Importer' button to open the Importer dockpane. On the dockpane all paths etc. should be filled in. Just click the 'Import into F/C' button. This will create a new feature class in the given geodatabase and then adds the csv data to that feature class. Maybe i left out something in my code, but i also have the remaining .lock file in my geodatabase folder. I am currently running 3.6 but i will try 3.4 tomorrow. I will add this code to the community samples with the 3.6 release, it hasn't been fully debugged.
... View more
06-05-2025
05:03 PM
|
0
|
0
|
585
|
POST
|
I am still looking at this, but this appears to be a bug in the API since the Path property is null when the tool is being executed. It looks like when the event is triggered only the GPResult property is populated in GPExecuteToolEventArgs , but unfortunately GPResult doesn't contain the tool path or id either. It looks like the Event is called twice, once with IsStarting set to 'true' before the tool runs and once with IsStarting set to 'false' after the tool completes. There are no provisions to 'cancel' the tool, so once the Path property is set to a proper value you will be able to get the tool's name to display a warning in case a 'specific' tool is run. I will report the issue to the GeoPrcoessing dev team. The 3.5 release contains a new GeoProcessing community sample called 'GPToolInspector' that contains the code to retrieve GPTool attributes from a given path. The 3.5 release is available next week. But unfortunately, you'll have to wait for the 'Path' property fix before you can implement a warning.
... View more
05-08-2025
08:02 AM
|
0
|
0
|
469
|
POST
|
I am looking at this issue, but in the meantime i think you can just use the button directly instead of setting the set enable editing API method: // if not editing
if (!Project.Current.IsEditingEnabled)
{
var res = MessageBox.Show("You must enable editing to use editing tools. Would you like to enable editing?",
"Enable Editing?", System.Windows.MessageBoxButton.YesNoCancel);
if (res == System.Windows.MessageBoxResult.No ||
res == System.Windows.MessageBoxResult.Cancel)
{
return;
}
// Project.Current.SetIsEditingEnabledAsync(true);
// use the esri_editing_ToggleEditingBtn instead for .SetIsEditingEnabledAsync
var damlId = "esri_editing_ToggleEditingBtn";
IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper(damlId);
var command = wrapper as ICommand;
if ((command != null) && command.CanExecute(null))
command.Execute(null);
}
... View more
05-01-2025
03:34 PM
|
0
|
1
|
309
|
POST
|
Hi @MinhHoangf Indeed the "Project" button (as @UmaHarano mentioned) is not a standard Framework Plugin (button) like the other tabs on the ArcGIS Pro ribbon. But, since ArcGIS Pro is a WPF application, and you can 'spy' on the WPF visual tree (you can use Visual Studio to do so) to find which control implements the "Project" button. I found that the "Project" control's name is "appButton" and the type of the control is "ActiproSoftware.Windows.Controls.Bars.RibbonApplicationButton". Once ArcGIS Pro is open you can use the code below to update the "Project" button to "New Caption". Note: since we can't access any ActiProSoftware resources the code below is using reflection to make the .Content property update: // change the caption of the 'Application' button in the main window: appButton
string newCaption = "New Caption";
var mainWindow = FrameworkApplication.Current.MainWindow;
if (mainWindow != null)
{
var appButton = mainWindow.FindName("appButton");
if (appButton != null && appButton is FrameworkElement frameworkElement)
{
System.Diagnostics.Trace.WriteLine($@"{appButton.GetType()}");
PropertyInfo propertyInfo = appButton.GetType().GetProperty("Content");
propertyInfo.SetValue(appButton, Convert.ChangeType(newCaption, propertyInfo.PropertyType), null);
}
} In similar fashion you can update the Application's titlebar, but be aware that the titlebar is getting overwritten by project names.
... View more
05-01-2025
02:43 PM
|
1
|
1
|
671
|
POST
|
I attached a small sample add-in project that has a Combo dropdown on the ArcGIS Pro ribbon and two dropdowns on a Dockpane. I am using a dictionary (keys and values) to 'feed' the dropdown content.
... View more
04-23-2025
10:20 AM
|
0
|
0
|
441
|
Title | Kudos | Posted |
---|---|---|
1 | 07-15-2022 07:30 AM | |
1 | 07-14-2025 02:08 PM | |
1 | 07-09-2025 12:13 PM | |
2 | 06-23-2025 03:23 PM | |
1 | 06-06-2025 11:55 AM |
Online Status |
Offline
|
Date Last Visited |
Thursday
|