title: How to get the machine configuration filename in .NET Core
body: <p>I am porting an application from .NET Framework to .NET Core (Standard).</p>
  
  <p>Within the application, we have the following code</p>
  
  <pre><code>   public LogMessageListenerFromConfig()
          : this(AppDomain.CurrentDomain.BaseDirectory.ConfigurationFile, LoggingSection.DefaultName)
      { }
  
      public LogMessageListenerFromConfig(string section)
          : this(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, section)
      { }
  
      public LogMessageListenerFromConfig(string filename, string section)
      {
          // todo: set up a file watcher and refresh the listeners (etc.) when it changes.
          var fileMap = new ExeConfigurationFileMap { ExeConfigFilename = filename };
          var configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
  
          _section = LoggingSection.Section(configuration, section);
          Refresh();
      }
  </code></pre>
  
  <p>This appears to be compatible with .NET Core apart from the following statement</p>
  
  <pre><code>AppDomain.CurrentDomain.SetupInformation.ConfigurationFile
  </code></pre>
  
  <p>There is no <code>SetupInformation</code> on an AppDomain anymore. Fair enough I read that it would cause issues etc. However, how else can I get the application configuration file name in a utility class?</p>
  
  <p>Please be aware that this class will be used in both console and asp.net (core) applications.</p>
  
  <p>Any help appreciated</p>
  
  <p>Stephen</p>