I'm trying to break the appSetting section inheritance chain (VS2010 C #)
Considering this,
Base.config
<appSettings>
<add key="basekey" value="basevalue"/>
</appSettings>
Derived.config
<appSettings file="Base.config">
<add key="derivedkey" value="derivedvalue" />
</appSettings>
App.config
<configuration>
<appSettings file="Derived.config">
<add key="mykey" value="myvalue" />
</appSettings>
</configuration>
This line:
ConfigurationManager.AppSettings["derivedkey"]
Throws an exception:
Unrecognized attribute 'file'. Note that attribute names are case sensitive. (... \ Derived.config line 1)
App.config seems to be able to successfully execute the “file” before Derived.config, but Derived.config will not be able to “transfer” the Base.config file because the “file” suddenly becomes unknown.
This is a bit circular / confusing to me, since the “file” attribute in App.config must be successfully recognized in order to reach Derived.config, where the same “file” attribute is unexpectedly unknown.