C# Projects and Config Files
<p>I'm trying to pull some key/values in my class.  This is a C# Class Library Project (not web project) so it's got an App.Config.</p>

<p>In my C# Project (Class Library), got the following:</p>

<p>1) <strong>A utility method to pull a key/value from a config file:</strong></p>

<pre><code>public class ConfigUtil
{
    /// &lt;summary&gt;
    ///  Utility method to retrieve configuration setting values.
    /// &lt;/summary&gt;
    /// &lt;param name="configKey"&gt;Configuration Settings key to retrieve.&lt;/param&gt;
    /// &lt;returns&gt;empty string if key is null&lt;/returns&gt;
    public static string GetAppConfigSetting(string configKey)
    {
        return ConfigurationManager.AppSettings[configKey] ?? string.Empty;
    }
}
</code></pre>

<p>This utility method was used in a web project and I just copied and pasted this nice helper into my C# Project because I need these auth and end points for authing to a third party API in some code in my C# Project.</p>

<p>2) <strong>A Config.cs to hold my lookups</strong></p>

<pre><code>class Config
{
    public static string SomeThirdPartyApiEndpoint
    {
        get { return ConfigUtil.GetAppConfigSetting("SomeThirdPartyApiEndpoint"); }
    }

    public static string SomeThirdPartyApiAuthUsername
    {
        get { return ConfigUtil.GetAppConfigSetting("SomeThirdPartyApiAuthUsername"); }
    }

    public static string SomeThirdPartyApiAuthPassword
    {
        get { return ConfigUtil.GetAppConfigSetting("SomeThirdPartyApiAuthPassword"); }
    }
}
</code></pre>

<p>3) <strong>In my App.Config, the key/values:</strong></p>

<pre><code>  &lt;appSettings&gt;
    &lt;add key="SomeThirdPartyApiEndPoint" value="http://someEndPointUrl.com/XMLAPI" /&gt;
    &lt;add key="SomeThirdPartyApiAuthUsername" value="someUserNameHere" /&gt;
    &lt;add key="SomeThirdPartyApiAuthPassword" value="5233s54" /&gt;
  &lt;/appSettings&gt;
</code></pre>

<p>4) <strong>Some example code in one of my classes in this project trying to pull one of the key values:</strong></p>

<pre><code>string password = Config.SomeThirdPartyApiAuthUsername;
</code></pre>

<p>this line is in one of my class methods.</p>

<p><strong>The problem</strong>: it's not finding any of my key/values.  When I debug, I get an empty string for password.  </p>

<p>I assume I'm doing this right in that these key/values need to be put in my App.Config since I do not have a web.config since this is not a Web Project.  This is a wrapper project I am creating to wrap calls to a third party API.  </p>

<p><strong>Another question related</strong>: So then would then ConfigurationManager.AppSettings look for an App.Config if a Web.config is not present?  I am wondering how this ConfigurationManager pulls...does it look for only web.configs or any .config available in the immediate project?</p>
