I'm in the process of converting an older ArcMap extension to an Add-In in C# and I am trying to best take advantage of the XML based configuration.

Config.esriaddinx works great for the basic set up (toolbar, buttons, extension info, etc), but is there a way to add other configuration parameters, such as field names, layer names, database connections, etc?

Would I need to create an App.config file? If so, would the App.config file still be packaged/deployed the same as the rest of the add-in? What would be the best method to read the parameters? I am a newbie to add-ins and any suggestions or samples would be greatly appreciated. Thanks!

2 Answers 2


First off, I have not tried using Config.esriaddinx for this purpose, but I wouldn't recommend it. It is meant for the configuration of the add-in itself, not necessarily user data, and you probably don't want to mix the two.

It has been a while since I've dealt with this myself so I may be a little fuzzy on the details, but there are multiple issues with using configuration files in ArcGIS add-ins: ArcMap Add-in with app.settings not recognizing app.config changes?

In particular, the directory the add-in is extracted to is overwritten each time the application is started, so you can't really persist changes to settings there. If your settings never change or only change with each new version of your add-in then this is probably not a concern.

If, however, you want to make your add-in configurable by the end user then you need to store the user-configurable information elsewhere so they aren't overwritten. I would suggest using the user's Application Data folder, whose path you can determine programmatically like so:


I would also suggest putting it in a subfolder named after your add-in. But essentially you would be loading from and saving to a file in that location instead of reading settings from your add-in's Settings class or the configuration file in the add-in's directory. If you want to use .NET configuration for this then I suggest reading up on Application Settings and ConfigurationManager.

The other problem I have had is with using custom configuration sections when using .NET configuration. Using Assembly.LoadFrom and handling the AssemblyResolve event was the solution to that particular problem, although in that case I ended up not using .NET configuration for that and other reasons.

Depending on the complexity of your configuration scenario, you could, like I did, eschew using the .NET configuration system entirely and instead use some other method of reading and writing configuration information. I ended up using SerializableAttribute-marked classes or classes which implemented IXmlSerializable for this purpose in one of the more complex add-ins I created which included user-configurable settings such as lists of layers, connection settings, etc. I would recommend reading Object Serialization in .NET, Introducing XML Serialization and How to Implement IXmlSerializable Correctly if you are interested in that approach.

It sounds like yours is along the same lines so it is up to you, but I found the XML serialization approach to be preferable to .NET configuration for all but the simplest of configuration scenarios (simple data types, no hierarchies/collections).

  • Great info here, @blah238! I'll expore these options and see what will work best.
    – petegis
    Commented Apr 19, 2013 at 16:42
  • How do you deploy the xml file to the Environment.SpecialFolder.ApplicationData folder when you distribute the addin file to your users? Is it a case of manually copy/pasting the file?
    – Vidar
    Commented Feb 12, 2014 at 17:35

Create a config.xml file and set it's build action to AddInContent under the VS properties for the file.

To add to this based on the comment, since you are doing it in C# I was assuming you are using Visual Studio to author your addin. From there if you add an XML configuration file from the file new option and name it config.xml it will create a default empty file. From there you can specify key value xml settings under the appSettings tag the same as a normal xml configuration file and then refer to these from code as you normally would. To change it's build action, when you have the file selected in VS, look at the properties window and there should be a build action setting. Select this and it will show a drop down of the available options, choose AddInContent from the list.

  • 1
    Welcome to GISse. This is a very brief answer. It would help to include some more detail, perhaps incorporating some of the details that @petegis mentioned, like how to add particular parameters to this file. Also, how would you go about creating this file? Is it done through ArcMap, or in a text editor? What is the proper structure? Think about if you had never created one before, what would you need to know in order to successfully do so. That sort of information will make for a superb answer. Good start! Commented Apr 19, 2013 at 0:38
  • Thanks @davetimmins. Seems straightforward enough, I gave this a shot and it works as long as the file is not actually named "config.xml" (throws a build error "Cannot create a file when that file already exists").
    – petegis
    Commented Apr 19, 2013 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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