Question

I wonder if there is a way or a workaround to have the config files in the following structure:

App.Config

<configuration>
  <appSettings configSource="AppSett.config">
    <add key="test1" value="test2"/>
  </appSettings>
</configuration>

and my AppSett.config will look like:

<appSettings>
  <add key="test3" value="test3"></add>
</appSettings>
Was it helpful?

Solution

No, you cannot use external file with partial info to link instead of the default config structure. Config files are special files that conform to config schema and this you cannot use them in the scenario you described.

OTHER TIPS

Yes, that's what configSource is for, but the configuration section can have content or configSource attribute, not both.

You can implement this approach by using file attribute instead of configSource:

In your example, you should have file App.Config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings configSource="AppSett.config">
    <add key="test1" value="test2"/>
  </appSettings>
</configuration>

and AppSett.config

<?xml version="1.0" encoding="utf-8" ?>
<appSettings>
  <add key="test3" value="test3"></add>
</appSettings>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top