Hi All,

I have been using ILMerge on the Castle Stack, and so far works great,
But I have hit a small snag and just thought I would share this to
help others:

In the Castle.Facilities.Logging.LoggingFacility class there is a
section that has these entries:

private static readonly String Log4NetLoggerFactoryTypeName =
        "Castle.Services.Logging.Log4netIntegration.Log4netFactory," +
Culture=neutral," +

private static readonly String NLogLoggerFactoryTypeName =
        "Castle.Services.Logging.NLogIntegration.NLogFactory," +
Culture=neutral," +

private static readonly String ExtendedLog4NetLoggerFactoryTypeName =
Culture=neutral," +

private static readonly String ExtendedNLogLoggerFactoryTypeName =
        "Castle.Services.Logging.NLogIntegration.ExtendedNLogFactory," +
Culture=neutral," +

ILmerge sees these as string literals and doesn't update the
references, causing logging not to work once ILmerged, from the
ILmerger Doco:

"The most frequent cause of problems when executing the target
assembly is that ILMerge has no way to merge resources. Therefore
resources are just copied over from the input assemblies into the
target assembly. If these resources encode references to types defined
in the input assemblies, then at runtime your program may fail because
the type returned from the resource does not match the type as it is
defined in the target assembly. You may even see a message that “type
‘T’ cannot be converted to type ‘T’”. This looks confusing because the
messages do not show the assembly that each type is defined in. The
actual error is that one type is defined in the input assembly while
the other is defined in the target assembly.
I do not know of any way to have ILMerge do the right thing in such
cases. There is no general way to decode resources and change any type
references they contain."

To resaolve the issue you need to use the customloggerfactory config

<facility id="loggingfacility" loggingapi="custom"
<Your Merged Assembly>"
type="Castle.Facilities.Logging.LoggingFacility, <Your Merged
Assembly>" />

Hope this helps someone else!
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to castle-project-users@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to