title: moving the config files for a dll to the app that calls the dll
body: <p>I have a web app that has search functionality.  The search algorithm is compiled to a separate dll.  In the C# code for the search algorithm, I am using strings held in a settings file to point to the directory where the search index resides.  Once the search code is compiled, the settings info is incorporated in <code>Search.dll.config</code> which is put in the bin directory along with Search.dll. Now in my web app, I add Search.dll to the references. The config file is not added into the web app. However the web app runs fine and knows where the file is. Because inside <code>Settings.Designer</code> it uses the <code>DefaultSettingValueAttribute</code> to assign a default if the config file is not there.</p>
  
  <p>How do I also add <code>Search.dll.config</code> to my web app so the operator can change the location of the index files on the server as need be?  </p>
  
  <p>Thanks</p>
  
  <p>EDIT:</p>
  
  <p>I tried to add the config file to my deployment folder.  But ASP.NET puts the dlls in a directory at C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root...... and the config file doesn't get copied there. So at this point I have no idea how to include the config file with my code.</p>
  
  <p>Thanks for your help.</p>
  
  <p>Note:</p>
  
  <p>I have been using the following code to get the values of the config file into the app. However, it depends on the dll and the config file to be in the same folder, which I do not know how to accomplish.</p>
  
  <pre><code>    var executingAssembly = System.Reflection.Assembly.GetExecutingAssembly();
      var location = executingAssembly.Location; //C:\MyApp\bin\Debug\Search.dll
      var config = ConfigurationManager.OpenExeConfiguration(location);
      var sections = config.Sections; //count of this is 21
      ConfigurationSectionGroup csg = config.GetSectionGroup("applicationSettings");
      ConfigurationSectionCollection csc = csg.Sections;
      ConfigurationSection cs = csc.Get("Search.Properties.Settings");
  </code></pre>