Menu

Configs collection empty after Load

Help
Anonymous
2012-07-11
2013-04-22
  • Anonymous

    Anonymous - 2012-07-11

    I'm trying to read this configuration file:

    DotNetConfigSource config = new DotNetConfigSource();
    config.Load("config.xml");
    

    config.xml:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <Section Name="UI">
            <Key Name="TargetIPAddress" Value="192.168.2.121" />
            <Key Name="TargetPort" Value="31002" />
        </Section>
    </configuration>
    

    it accepts the Load method, but the Configs collection remains empty.

    any idea why?

     
  • Anonymous

    Anonymous - 2012-07-12

    You are using the wrong class for the file type. DotNetConfigSource class is for the App.config that are created for .NET applications. Visual Studio usually creates one of those when you create a new solution.

    What you need is XmlConfigSource. First, change the configuration back to Nini, as you had in a previous post. The usage is in this section of the manual:  http://nini.sourceforge.net/Manual/NiniManual-4.htm#XmlFiles

    Let us know if this fixes your issue.

     
  • Anonymous

    Anonymous - 2012-07-15

    Thanks Hector

    Its working now.

     

Log in to post a comment.

MongoDB Logo MongoDB