简体   繁体   中英

Nested app.config (web.config) files

Is it possible to have two app.config files where one app.config serves as a container for second (nested) app.config file? I would like to reference specific sections of a nested file from the outer one.

Why I need this is because of source control issue. For detailed description see this

Any other solution for the root problem is greatly appreciated.

You can reference other config files yes, so you can have static stuff in one file, and machine specific stuff in another.

Eg, to put app settings in a seperate file, in a subfolder called "configuration":

<appSettings configSource="Configuration\AppSettings.config"/>

Then in the AppSettings.config, just include the appSettings tag as normal:

<appSettings>
   <add key="somekey" value="someValue" />
</appSettings>

If I understand your question correctly, the answer is "Yes". See the section on "Using External Configuration Files" in this article. It's not nesting the files as your title would imply, but based on the question text...

http://msdn.microsoft.com/en-us/library/ms254494.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM