appSettings file attribute equivalent for applicationSettings
Asked Answered
R

1

6

In a asp.net web.config file you can do

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

and it will look in local.appSettings.config for any overrides to the foo/bar setting.

Is there an equivalent for applicationSettings? Something like this

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

or even a different approach to maintaining a different set of applicationSettings, for instance a set for local development, and a set for production

Range answered 19/2, 2010 at 22:0 Comment(0)
W
3

I am unaware of an equivalent, but you can utilise the configSource attribute and store the application settings in an external file. Using the configSource attribute, there will not be a merging of settings. Also, I believe the configSource is available starting in .Net 2.0.

Winkle answered 20/2, 2010 at 1:54 Comment(1)
configSource doesn't seem to be an optional file though. If the file cannot be found, an exception is thrown. Is there a way to make it optional?Astridastride

© 2022 - 2024 — McMap. All rights reserved.