user.config location?

Add-in Express™ Support Service
That's what is more important than anything else

user.config location?
I need to find the location of the user.config created for my Outlook Add In Module 
Jens Schneider




Posts: 13
Joined: 2014-08-13
I can find the location of the user.config manually and it is here: C:\Users\TestUser\AppData\Local\Microsoft_Corporation\C__Users_TestUser_AppData_Path_n1uz4of1wqm1raru2xbg1ix44vfujobn\15.0.4615.1000

However, programatically, using the following:

            try
            {
                var configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                MessageBox.Show(configuration.FilePath);
                File.Delete(configuration.FilePath); 
            }
            catch (Exception ex)
            {
            }

            try
            {
                var configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoaming);
                MessageBox.Show(configuration.FilePath);
                File.Delete(configuration.FilePath); 
            }
            catch (Exception ex)
            {
            }

            try
            {
                var configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
                MessageBox.Show(configuration.FilePath);
                File.Delete(configuration.FilePath);
            }
            catch (Exception ex)
            {
            }


None of the configuration File Paths point to it. They point to something with and Add In Express path.

How can I find the user config locations of my add in?

My goal is to remove the file on UnInstall. I tried using Settings.Default.Reset() then Settings.Default.Save() but that did not remove the file.
Posted 11 Sep, 2014 09:44:26 Top
Andrei Smolin


Add-in Express team


Posts: 16739
Joined: 2006-05-11
Hello Jens,

Try looking for the .config file starting from System.Reflection.Assembly.GetExecutingAssembly().CodeBase.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 12 Sep, 2014 08:26:23 Top
Jens Schneider




Posts: 13
Joined: 2014-08-13
Thank you Andrei, but that returns the location of the DLL.

I have found a workaround which is to keep a setting of my assembly version and check if there is a difference on startup. If there is, I reset settings back to default.
Posted 12 Sep, 2014 09:56:05 Top
Andrei Smolin


Add-in Express team


Posts: 16739
Joined: 2006-05-11
Jens Schneider writes:
Thank you Andrei, but that returns the location of the DLL.


The .config file is located in the same folder.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 12 Sep, 2014 10:05:04 Top