Shared ConfigSection with 'enterpriseLibrary.ConfigurationSource'

Topics: Enterprise Library Core
Jun 10, 2014 at 10:34 AM
I'm using entLib 6.0 for the shared config only. I have now two problems/question about the App.config file:

-Is there a way to set different <enterpriseLibrary.ConfigurationSource .... > <sources> for "Debug" and "Release" in the App.Config? That would be very interesting for simplifying the debug/development process.

-Is there a way to set the path for a shared config source with the following syntax "%CommonDocuments%\CompanyName\Product\SharedConfig.config" instead of "C:\Users\Public\Documents\CompanyName\Product\SharedConfig.config" ?
That is really needed for us.

Thank's for your answers!
Jun 11, 2014 at 1:43 AM
Unfortunately, the answers to your questions are: no.

Enterprise Library still supports Environment-Specific Configuration through delta files bit it's a bit cumbersome and I'm not sure if it applies to your scenario. However, configuration transforms might be a better fit. See for an example for using on app.config.

FileConfigurationSource does not expand environment variables. It would be straight forward to modify the source to do this. Another option would be to use FileConfigurationSource programmatically and read the location in from configuration and then expand the environment variable and pass it to the FileConfigurationSource.

Randy Levy
Enterprise Library support engineer
Support How-to