views:

543

answers:

2

I'm using a web deployment project and want to do some section replacement with the emlah/errorMail section. I don't want to send emails in debug build mode.

I have created the custom section and put it in an errorMail.config. In the properties of web deploy project under replacements, I have elmah/errorMail=errorMail.config.

The error I'm getting is An error occurred creating the configuration section handler for elmah/errorMail: Could not load file or assembly 'Elmah' or one of its dependencies. The system cannot find the file specified.

I'm guessing this is happening because Elmah is not in the GAC or it's not one of my projects. The Elmah.dll file does copy to the output\bin folder just fine though.

Is there a way to have section replacements work with 3rd party dlls?

[EDIT]

I found that if I drop the dll in question into the project folder for the web deployment project, that it will work fine. This is less than optimal.

So now my question is, how can I get this to work without having to put the dll in the GAC or having to copy the dll into the web deployment project folder?

+1  A: 

If you add a reference to the elmah dll from your webproject, then it will automatically copy the dll to the output folder when you build it.

Those are the only 2 options though: to have the dll copied to the output directory or to put it in the GAC

Matthew Steeples
A: 

A technique proposed here dynamically loads an assembly during the web deployment build process so that it doesn't have to be in the GAC. I tried, but was unable to get it to work, though.