6

在 asp.net web.config 文件中,您可以执行

<appSettings file="local.appSettings.config">
    <add key="foo" value="bar" />
</appSettings>

它将在 local.appSettings.config 中查找对 foo/bar 设置的任何覆盖。

是否有 applicationSettings 的等价物?像这样的东西

<applicationSettings file="local.applicationSettings.config">
    <FooBar.My.MySettings>
        <setting name="foo" serializeAs="String">
            <value>bar</value>
        </setting>
    </FooBar.My.MySettings>
</applicationSettings>

甚至是维护一组不同的应用程序设置的不同方法,例如一组用于本地开发,一组用于生产

4

1 回答 1

3

我不知道等效项,但您可以利用 configSource 属性并将应用程序设置存储在外部文件中。使用 configSource 属性,将不会合并设置。另外,我相信 configSource 从 .Net 2.0 开始可用。

于 2010-02-20T01:54:03.263 回答