Select to view content in your preferred language

Ribbon button images not displaying

2598
7
Jump to solution
08-04-2017 03:47 PM
mfcallahan
Frequent Contributor

I can't seem to get the icon images to display in my ArcGIS Pro Add-ins.  I'm using the default sample icons provided in the ArcGIS Pro SDK Community Samples.  Here is a quick screenshot of my solution, showing the folders where the images are saved, and the Config.daml file where they are referenced:

However, the icons do not get displayed when the add-in is executed:

The icons DO work for the sample add-in projects, however.  The image files and location are the same in my solution and the sample solution. The markup referencing the images is the same as well.

What should I be looking for in my solution to properly set an image as the ribbon button icon in ArcGIS Pro?

Tags (4)
0 Kudos
1 Solution

Accepted Solutions
CharlesMacleod
Esri Regular Contributor

Make sure the build action is set to "AddInContent"

View solution in original post

7 Replies
CharlesMacleod
Esri Regular Contributor

Make sure the build action is set to "AddInContent"

mfcallahan
Frequent Contributor

Thank you for the reply - this solved my issue. Good to know that I need to set the build action when I bring in some more custom icons.

0 Kudos
RichardDaniels
Honored Contributor

AddInContent is no longer an option in Visual Studio 2022 for ArcGIS Pro 3.x projects. 🤔

0 Kudos
HagenProbsthain2
Occasional Contributor

Richard, meanwhile, do you have a solution for Visual Studio 2022 and ArcGIS Pro 3.x? I have the same problem, wasting hours an hours, but nothing helps, the Image is not shown on the button. Also the Microsoft Copilot has no solution.

0 Kudos
RichardDaniels
Honored Contributor

After some checking, it looks like the 'AddInContent' Build Action for icons (or png files) in Pro AddIn is now just 'Content'.

RichardDaniels_1-1751412748168.png

 

 

Of note, in your config.daml you have the 'stub path' to the icon in the Image tag like so: <Image>Images\diamond_blue_32bit.png</Image> 

 

If your icon is still not showing, then add the .\images folder to your Add-In file structure and add the icons or pngs you want to display.

0 Kudos
HagenProbsthain2
Occasional Contributor

Thank you for your quick reply. Yes, I've already tried that. "Content/always copy" and also "Resource/always copy." I added the image to the project using "Add > Existing Item." It's a test project with nothing other than this button and the image (see pic 1). The image is set as a large image (see pic 2). I've also edited/saved the image with IrfanView, Paint.NET, Gimp, and the Visual Studio Image Editor. It was created from the working AddInDesktop32.png file; if I use those, it's displayed on the button. Then I cleaned it up and recreated it. No success. The button is always displayed as a GenericButton (see pic 3). After creating the project, the add-in is created in the user's Documents directory. When I open it with 7-zip, I see that it contains an image that no longer exists and isn't referenced in the project (AddInDesktop32Gimp.png). But my Image1.png is also included (see pic 4). The images are also included in the assembly cache (see pic 5). So everything seems to be ok. I don't know what else to try. I suspect that saving with the image editors mentioned above will prevent ArcGIS Pro from displaying the image. I'm using ArcGIS Pro 3.5 and Visual Studio 2022 with VB.NET. Sorry for the German GUI.

0 Kudos
HagenProbsthain2
Occasional Contributor

The solution was to use the image properties: "Content / do not copy".

I thought it had to be copied into the add-in anyway. However, ArcGIS Pro loads the images from the add-in, not from the build folder. The images are included directly from the project directory into the .esriAddInX package. When you select a copy option, Visual Studio also copies the image files to the bin\Debug folder. When building the add-in (.esriAddInX), naming conflicts or duplicate resource paths can occur. This can lead to the images not being included or referenced correctly, even though they are visible in the project.

0 Kudos