繁体   English   中英

告诉ConfigurationManager忽略App.config部分

[英]Tell ConfigurationManager to ignore App.config section

我的App.config文件标记为:

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

所以,我有一个配置文件,其中:

  • 一节(“Custom”)由API处理,我为它编写了ConfigurationSection继承者
  • 第二部分(“忽略”)我将自己解析,因为Configuration API不让我解决我的任务。

当我运行程序时,异常发生“无法识别的配置部分'忽略'”。

我是否有可能告诉ConfigurationManager忽略此部分“忽略”?

您可以将以下内容添加到<configSections>元素:

<section name="Ignored" type="System.Configuration.IgnoreSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM