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.

You May Also Like

About the Author: rnowik

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.