How to add a dll config file to a project that add the dll as reference?
<p>I wrote a UserLogin dll. 
The dll is using App.Config file with some default parameters. I have renamed the config file to UserLogin.Config for better files system readability.</p>

<p>I wrote a new application requiring login of users. I added the UserLogin.dll as reference to the new application. The problem is that the config file was not added with the reference. I have to add it manually to the bin\debug folder to be able to run the application through Visual Studio.</p>

<p>I do not have a such problem for deploying it since I am adding the config file as part of the setup.</p>

<p>What is the correct way to add the config file to the new application so I can run it in development environment?</p>

<p>Following is the UserLogin.config file:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;configuration&gt;
    &lt;appSettings&gt;
        &lt;add key="IsTestEnvironment" value="false" /&gt;
        &lt;add key="AllowedUserForTestEnvironment" value="ehh" /&gt;
        &lt;add key="EnableLogging" value="false" /&gt;
     &lt;/appSettings&gt;
&lt;/configuration&gt;
</code></pre>

<p>The class that reads from the UserLogin.config file:</p>

<pre><code>public static class ConfigurationReader
{
    private static AppSettingsSection _appSettings;

    public static AppSettingsSection AppSettings
    {
        get
        {
            if (_appSettings == null)
            {
                var userPreferencesConfigFileMap = new ExeConfigurationFileMap();
                userPreferencesConfigFileMap.ExeConfigFilename = "UserLogin.config";
                var userPreferencesConfig = ConfigurationManager.OpenMappedExeConfiguration(userPreferencesConfigFileMap, ConfigurationUserLevel.None);
                _appSettings = (AppSettingsSection)userPreferencesConfig.GetSection("appSettings");                                        
            }

            return _appSettings;
        }
    }

    public static bool IsTestEnvironment
    {
        get
        {
            return bool.Parse(AppSettings.Settings["IsTestEnvironment"].Value);
        }
    }

    public static string AllowedUserForTestEnvironment
    {
        get
        {
            return AppSettings.Settings["AllowedUserForTestEnvironment"].Value;
        }
    }

    public static string EnableLogging
    {
        get
        {
            return AppSettings.Settings["EnableLogging"].Value;
        }
    }
}
</code></pre>

<p>The new Application that use the UserLogin.dll:</p>

<p><a href="https://i.stack.imgur.com/wAMAG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wAMAG.png" alt="enter image description here"></a></p>