title: How to read app.config from another assembly?
body: <p>I have two projects:</p>
  
  <ul>
  <li>Console project (Test.exe)</li>
  <li>Class Library project (Test.Data.dll)</li>
  </ul>
  
  <p>My Class Library project contains an <code>app.config</code> file.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
    &lt;connectionStrings&gt;
      &lt;add name="TestEntities" connectionString="metadata=res://*/DBNews.csdl|res://*/DBNews.ssdl|res://*/DBNews.msl;provider=System.Data.SqlClient;provider connection string=&amp;quot;{0}&amp;quot;" providerName="System.Data.EntityClient" /&gt;
    &lt;/connectionStrings&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>From the Console project I want to access the settings from the Class Library, so I've tried:</p>
  
  <pre><code>var config = ConfigurationManager.OpenExeConfiguration("Test.Data.dll");
  config.ConnectionStrings.ConnectionStrings[0].Name; // LocalSqlServer
  // seems to be the wrong assembly.
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>var config = ConfigurationManager.OpenExeConfiguration("Test.Data.dll.config");
  // invalid exePath
  </code></pre>
  
  <p>How can I access the DLL's <code>app.config</code> ?</p>