Is there a way to retrieve configSource from code? I founded How to programmatically retrieve the configSource Location from config file, but all answers are wrong.
I have following config:
<configuration>
<appSettings configSource="appsettings.config"/>
</configuration>
When I tried to invoke following code:
var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
var file = config.AppSettings.File;
file is always empty. Same is for ConfigurationManager.AppSettings["configSource"]. I think something changed in .NET 4, because answers are old ones.
I tried also config.AppSettings.SectionInformation.ConfigSource but it is also empty.
I need this path to enable monitoring of appSettings. You could read more: How to discover that appsettings changed in C#?
ConfigSourceproperty didn't work? msdn.microsoft.com/en-us/library/…