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," +
        "Castle.Services.Logging.Log4netIntegration,Version=1.0.3.0,
Culture=neutral," +
        "PublicKeyToken=407dd0808d44fbdc";

private static readonly String NLogLoggerFactoryTypeName =
        "Castle.Services.Logging.NLogIntegration.NLogFactory," +
        "Castle.Services.Logging.NLogIntegration,Version=1.0.3.0,
Culture=neutral," +
        "PublicKeyToken=407dd0808d44fbdc";

private static readonly String ExtendedLog4NetLoggerFactoryTypeName =
        "Castle.Services.Logging.Log4netIntegration.ExtendedLog4netFactory,"
+
        "Castle.Services.Logging.Log4netIntegration,Version=1.0.3.0,
Culture=neutral," +
        "PublicKeyToken=407dd0808d44fbdc";

private static readonly String ExtendedNLogLoggerFactoryTypeName =
        "Castle.Services.Logging.NLogIntegration.ExtendedNLogFactory," +
        "Castle.Services.Logging.NLogIntegration,Version=1.0.3.0,
Culture=neutral," +
        "PublicKeyToken=407dd0808d44fbdc";

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
parameter:

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

Hope this helps someone else!
Thanks!
M
--~--~---------~--~----~------------~-------~--~----~
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 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to