App.config: the appSettings file attribute is not read from Local.config

I have a test project with App.configthat sets default values ​​for some parameters. I want to override these settings locally so that every developer can, for example, use their own credentials.

In my App.config, I have the following:

<appSettings file="Local.config">
    <add key="Username" value="USERNAME"/>
    <add key="Password" value="PASSWORD"/>
</appSettings>

in Local.config (in the same directory) I have the following:

<appSettings>
    <add key="Username" value="wayne"/>
    <add key="Password" value="secret"/>
</appSettings>

When I run my test, I expect that getting the Username value will return "wayne" from Local.config; instead, it is "USERNAME" from App.config - it seems like it doesn’t actually detect that I want to override the settings in another file.

What am I doing wrong?

+5
source share
1

, , Local.config ?

+7

All Articles