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. |
|
Andrei Smolin
Add-in Express team
Posts: 19029
Joined: 2006-05-11
|
Hello Jens,
Try looking for the .config file starting from System.Reflection.Assembly.GetExecutingAssembly().CodeBase.
Andrei Smolin
Add-in Express Team Leader |
|
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. |
|
Andrei Smolin
Add-in Express team
Posts: 19029
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.
Andrei Smolin
Add-in Express Team Leader |
|