Log4Net & Combres (merged) – Ambiguous Reference

Dec 1, 2010 at 6:42 AM

I got into a project that already is making use of Combres.  The combres version being used is the merged one that includes log4net, among others.

Got a task to implement logging using log4net, which I first sorted out in a demo project.  Works fine.

However, when I work in my stuff into the project, I get an ambiguous reference error when I try to compile.

Removing my log4net reference solves the problem, but then, nothing get logged to the database.

I simulated the problem in the demo project.  Remove the log4net reference, and add a reference to combres….all seems to work, but nothing logging to database.  Remove combres, add log4net reference…logging to database.

I’m not in the position to change the code using combres, so will have to figure out something.  One thing that comes to my mind is recompile the combres source without log4net.  Not sure how to do that.

Note:  The current code depends on whatever is in combres combined dll….cannot just remove it and add a reference to the “normal” combress dll.

Dec 1, 2010 at 12:39 PM

I think your best bet is still to get rid of the combined/merged Combres version and replace it with individual dll's. The merged Combres file contains:

- Combres.dll
-fasterflect.dll
- log4net.dll
- ajaxmin.dll
- yahoo.yui.compressor.dll
- ecmascript.net.modified.dll
- dotless.Core.dll

Another possibility is to use assembly redirecting in you web.config, but I'm not sure if this would work if your project contains two versions of log4net. Example can be found here:

http://www.telerik.com/help/aspnet-ajax/installwebconfigbindingredirect.html

 

Dec 1, 2010 at 4:53 PM

Solved!

What happened was that I had 3 assemblies.  One with my contract (ILoggerService), one with my implementation (Log4NetLoggerService) and a MVC project.

In the MVC project I made use of the log4net embedded in combres, but my implementation had a reference to log4net.dll.  Took that away, referenced combres.dll...works.