Pregunta

My App.config file is markuped as:

<configuration>
    <configSections>
        <section name="Custom" type="…" />
    </configSections>
    <Custom>
        ...
    </Custom>
    <Ignored>
        ...
    </Ignored>
</configuration>

So, I have an configuration file, where:

  • one section ("Custom") is handled by API and I have written ConfigurationSection inheritor for it
  • second section ("Ignored") I will parse by myself, because Configuration API doesnt let me solve my task.

When I run program, exception occurs "Unrecognized configuration section 'Ignored'".

Do I have possibility to tell ConfigurationManager to ignore this section "Ignored"?

¿Fue útil?

Solución

You can add the following to your <configSections> element:

<section name="Ignored" type="System.Configuration.IgnoreSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top