PowerPoint PlugIn does not read defaults from .dll.config file

Posted by Nick T on Stack Overflow See other posts from Stack Overflow or by Nick T
Published on 2010-04-26T18:30:39Z Indexed on 2010/04/26 18:33 UTC
Read the original article Hit count: 200

I'm working on a very simple PowerPoint plugin, and I'm quite a bit stumped. In my settings.settings file, I have configured a setting "StartPath", which references where the PowerPoint plugin will navigate to using a Browser component.

After I compile the application, and run the installer generated by the Setup project, the application is installed and uses the default value in the settings file. However, if I edit the application.dll.config file, the plugin still uses the old values.

How can I set things up such that the plugin references the .dll.config file and not its default settings?

The code to access the settings is listed below, including the other variants I have tried:

//Attempt 1
string location = MyApplication.Properties.Settings.Default.StartPath;

//Attempt 2
string location = ConfigurationManager.AppSettings["StartPath"];

//Attempt 3: Configuration element is inaccessible due to its protection level
string applicationName = Environment.GetCommandLineArgs()[0] + ".exe";
string exePath = System.IO.Path.Combine(Environment.CurrentDirectory, applicationName);
Configuration config = ConfigurationManager.OpenExeConfiguration(exePath);
string location = config.AppSettings["StartPath"];

© Stack Overflow or respective owner

Related posts about .NET

Related posts about settings.settings