开发者

Reading specific config file

开发者 https://www.devze.com 2023-03-24 12:25 出处:网络
I made my custom configuration classes to parse data from my config section. My project is class library which means it creates dll. I found this way to retrieve my config section:

I made my custom configuration classes to parse data from my config section. My project is class library which means it creates dll. I found this way to retrieve my config section:

return (ReportServerConfigurationSection)ConfigurationManager.GetSection(sectionGroup + "/" + sectionName);

But this only works for .exe applications. I waned to test my dll with specific config in some integration test but I cannot manage to r开发者_如何学Pythonead from correct config.

How to read from app.dll.config file?


You can use ConfigurationManager's OpenExeConfiguration(string) method:

http://msdn.microsoft.com/en-us/library/ms224437.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消