0

I have a project that adds some functionality to Excel. The way it is setup right now, includes adding "C:.....\Excel.exe" as the start action (Under Debug>Start Action>Start external program)

Now I have a config file (app.config), but when I use ConfigurationManager to read the config items, it reads the C:...\Excel.exe.config file instead of Myapplication.exe.config (or app.config)

Is there a way of making it read my application.exe.config? I've tried ConfigurationManager.OpenExeConfiguration() method but it seems that the config items are not enumerable using this method

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
user3711455
  • 93
  • 1
  • 7

1 Answers1

0

Use this:

Configuration config = ConfigurationManager.OpenMappedExeConfiguration(new ExeConfigurationFileMap { ExeConfigFilename = "pathToConfigFile" }, ConfigurationUserLevel.None);
Sam Aleksov
  • 1,201
  • 6
  • 12