From this thread:

Can you programmatically change the button image for a ESRI.ArcGIS.Desktop.AddIns.Button?

I've learned to change a command image programmatically, but... how can I programmatically get an image from the "Images" folder of the Addins, avoiding to write the physical file path?

Is there a way to quickly get access to the Addins resources?

| improve this question | | | | |

I guess it depends on what you mean by "quickly". The images are unpacked into the AssemblyCache under the user's profile.

Win7 example:

I get the directory with something like this:

string dirpath =    Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),"Images")

And then you can use normal .NET file IO to access the files. And these would be the files in visual studio that have a build action of AddInContent.

You can also add files with a build action as Embedded Resource and get it with GetManifestResourceStream:


There might be other methods, but the two above are what I've used (I guess 3 of you count resources).

| improve this answer | | | | |
  • I'm sorry for my english: "quickly" it means for me a direct method from addins objects or something...but till now I have not found it. However, thank you for your suggestion, I tried it, but there is no Images folder in that path! I'm working on Windows Server 2003 and I get:C:\Documents and Settings\Administrator\Impostazioni locali\Dati applicazioni\ESRI\Desktop10.0\AssemblyCache\{26978580-636C-C40B-39CA-32C16B98529C} I can see only the .dll files in this folder. Otherwise I don't like the Embedded Resource solution, I hope it's not the only way. – user3835 Aug 3 '11 at 8:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.