configSource only works on sections, not sectionGroups
I have an app.config with some custom sectionGroups:
<configSections> <sectionGroup name="MyApp"> <section name="foo" type="System.Configuration.NameValueSectionHandler, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> </sectionGroup> </configSections> <myApp> <foo> <add key="MySetting" value="14"></add> </foo> </myApp>
I wanted to externalize that:<MyApp configSource="myapp.config">
This yields an error:
System.Configuration.ConfigurationErrorsException: The attribute 'configSource' cannot be specified because its name starts with the reserved prefix 'config' or 'lock'.
Long story short: configSource
only works on <section>
elements, not on <sectionGroup>
.