Tech Off Post

Single Post Permalink

View Thread: Configuration Files
  • User profile image
    AndyJ

    Since you mention unit testing, if you're using NUnit, they do use an assembly by assembly config file approach. Any dll that calls the standard ConfigurationSettings methods will be directed to a config file with the name of the tested assembly. In other words if I'm testing MyDLL.DLL the config file will be MyDLL.DLL.Config rather than MyAPP.EXE.Config.

    However, if you want to know how to load a config file for independant assemblies, there are methods. One way is to load your DLL into a seperate AppDomain. Each appDomain can specify it's own Config file. Another, perhaps easier way, is to write your own version of ConfigurationSettings that opens up a DLL specific config file as a regular XML file and parses out the data....

    -Andy
    www.geekswithblogs.org/ajohns