Reading a config file from a test project

Reading a config file from a test project. Simply put the config file in the bin folder (the config file must be named the file dllname.dll.config, where dllname is the name of the test dll). To access the config entries in the code, use System.Configuration.ConfigurationSettings.AppSettings[“keyname”].ToString(); or equivilant.

Note that Visual Studio 2005 will generate a warning that System.Configuration.ConfigurationSettings.AppSettings is obsolete and has been replaced by System.Configuration.ConfigurationManager.AppSettings, however configuration manager does not appear to be available in the system.configuration namespace in a test project. I do not understand why this is yet.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>