0
votes

I am developing a plugin for a .NET 4 application and I want to add a config file to the dll as I dont want to put the configuration in the main config file. I have added the app.config t the project and it is correctly compile and dllName.dll.config generated.

Here is my configuration file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="MyTabsConfig" type="NewApp.UI.MyTabsConfigHandler, NewApp.UI" />
  </configSections>
  <MyTabsConfig>
    <MyTabs>
      <MyTab Name="First" Leads="2" />
      <MyTab Name="Second" Leads="4" />
      <MyTab Name="Third" Leads="1" />
    </MyTabs>
  </MyTabsConfig>
</configuration>

Now I have 1 problems: If I copy the file in the ExtraPlugins directory of my main application, NewApp.UI.dll cannot be found when calling GetSection("MyTabsConfig"). I think it is looking in the main application folder.

Thanks.

1

1 Answers

0
votes

Have you tried something like this?

ConfigurationSection section = ConfigurationManager.OpenExeConfiguration("myConfig.config").GetSection("mySection");