EHAB in a Class Library

Topics: Exception Handling Application Block
Jan 22, 2007 at 3:21 PM
I wish to add exception handling to a class library that I am developing. When I reference the library from a console app, my EHAB policies do not work: the config section is unable to be found. So, I thought "yes, that makes sense - I'll copy my library's config file to the console app's BIN". Still didn't work. I stepped through the code and found that the EHAB runtime is looking for config info in a file that would be named according the the name of my console app. So, I added a config file for the console app and copied the EHAB config section from my class library to this new config file for the console app. Technically, it makes sense, but I don't want applications using my library to be responsible for knowing the details of the library's exception handling settings: it should be encapsulated in the library itself. Am I doing something wrong or is there a way around this?
Jan 22, 2007 at 6:28 PM
The behavior you are seeing is the way that .NET deals with configuration files by default. However there are a few ways around this with Enterprise Library. Take a look at for a description of your options.

Jan 22, 2007 at 6:49 PM
Hello and thank you for the reply. The link you provided "looks" like what I am after though I have only glanced over it thus far. I will try the recommendations in the article and report the results. Thanks again!
Jan 22, 2007 at 7:25 PM
IT WORKS!!! Thank you so much!!!