locked
Reading ApplicationSettings from another assembly RRS feed

  • Question

  • I have an object which uses another, I want the first object to use the ApplicationSettings found in the second objects (a dll) app.config file, how can this be done.

    If it were the the object reading it's own .config file I could use implementation of System.Configuration.ApplicationSettingsBase but it's not.
    The calling object will only know the name of the name and path of the dll, hence I've been playing with
    System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration
    but this does not give me access to and ApplicationSettings Property (like appSettings does), how can I access the keys and values themselves?

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
    <section name="Template.Project" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
    </configSections>
    <applicationSettings>
    <Template.Project>
    <setting name="Server" serializeAs="String">
    <value>http://localhost//Server</value>
    </setting>
    <setting name="loggingPath" serializeAs="String">
    <value>C:\logs</value>
    </setting>
    </Template.Project>
    </applicationSettings>
    </configuration>
    Monday, December 4, 2006 4:58 PM

Answers