Vajda
Vajda

Reputation: 1794

Reading specific config file

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 read from correct config.

How to read from app.dll.config file?

Upvotes: 0

Views: 2741

Answers (1)

heisenberg
heisenberg

Reputation: 9759

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

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

Upvotes: 1

Related Questions