I have made a custom add-in using C#.NET(a toolbar that contains buttons) and I was wondering if it is possible to have some code execute upon the install of the .esriaddin file. Basically I want to create a directory with some map templates on the users computer. I can just add the

DirectoryInfo di = Directory.CreateDirectory(@"Path"); etc....

to the on click event of the buttons and have it only execute if the folder doesn't exist but I was wondering if there was a way to execute it on install so I don't have to include it within the buttons.

Edit: I have looked at this and it is similar though I'm not using a custom installer.

closed as off-topic by Mapperz Jun 5 '14 at 20:17

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about software development are off-topic here unless they relate directly to Geographical Information Systems, but they can be asked on Stack Overflow." – Mapperz
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    I always include an extension class in my AddIns and handle initialization methods in the Startup methdod (and in some cases the extension class's constructor if I need some early logging). – Jay Cummins Jun 5 '14 at 19:43
  • @Mapperz do you have the ability to migrate the question to SO? – landocalrissian Jun 6 '14 at 11:35
  • Not sure why this is marked as off-topic seeing as it's directly related to ArcGIS development. – pvdev Jun 9 '14 at 11:13
  • 1
    You'll want to create an 'extension' class and set it to inherit from ESRI.ArcGIS.Desktop.AddIns.Extension, then call startup code inside the OnStartup() function (declare this as protected overrides). – pvdev Jun 9 '14 at 11:19