Include other files in config files in dotnet

A seldom used feature of dotnet config files is the possibility to link to another file.  Use configSource=”theotherfile” or file=”theotherfile” as attribute.  An example and comments are found here.

This is old news indeed but every time I use it I tend to google for a while since I cannot remember the keywords.

Example of use:

I have an ordinary app.config file.  It links to connectionstrings.config which keeps my <drumroll/> development connection string.  For creating an installation file I have a normal setup/installation project.  This project takes the file connectionstrings.prod.config and incorporates it in the MSI while renaming it to connectionstrings.config.

Tags: , , , ,

Leave a Reply