I have a custom .NET addin for an application and I am trying to create configSections for the addin's config file. The trouble is I am not able to read that section If load the configuration using the OpenMapperExeConfiguration/OpenExeConfiguration.
Here is my config file(MyTest.dll.config)
<configuration>
<configSections>
<section name="test" type="MyTest, Test.ConfigRead"/>
</configSections>
<test>
..Stuff here
</test>
<appSettings>
<add key="uri" value="www.cnn.com"/>
</appSettings>
</configuration>
Here is my code sample to access the test configSection
ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
fileMap.ExeConfigFilename = Assembly.GetExecutingAssembly().Location + "config";
Configuration applicationConfig = ConfigurationManager.OpenMappedExeConfiguration(fileMap,ConfigurationUserLevel.None);
//Using OpenExeConfiguration doesnt help either.
//Configuration applicationConfig = ConfigurationManager.OpenExeConfiguration(Assembly.GetExecutingAssembly().Location);
//Accessing test section
applicationConfig.GetSection("test");
//Accessing AppSettings works fine.
AppSettingsSection appSettings = (AppSettingsSection)applicationConfig.GetSection("appSettings");
appSettings.Settings["uri"].Value;
As shown appsettings value can be read just fine. Is it possible to have configSections in any other config other than the main application's config file?