I have a solution divided into two projects, one for a Class Library and another one for Unit Tests (using NUnit 2.5). Now, on the App.config file of the Class Library project I added several lines like
<add key="KeyName" value="KeyValue"/>
which I am reading in the class library code with
Configuration开发者_Python百科Manager.AppSettings["KeyName"].
The problem is that when I run the unit tests the class library can't access those values because even though that code is used from within the library, it goes looking for them in the App.config of the Unit Tests project. If I add those line to this file everything goes smooth, but that's of course not what I want. How can I tell ConfigurationManager
to look for the keys in the right application path?
use ConfigurationManager.OpenExeConfiguration("file path") to open correct path
精彩评论