You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Jeremiah Voris <je...@gmail.com> on 2005/08/01 01:30:59 UTC

Re: How do I set Category/Event in EventLogAppender?

On 7/30/05, Ron Grabowski <ro...@yahoo.com> wrote:
> (You probably already know this) You don't need the .snk file to build
> in Release mode. If you comment out these lines from the
> AssemblyInfo.cs file:
> 
>  #if STRONG
>  [assembly: AssemblyDelaySign(false)]
>  [assembly: AssemblyKeyFile(@"..\..\..\log4net.snk")]
>  #endif
> 
> You can build in Release mode.

Yeah, I did know that but I figured I might as well get it working
with the signed key since the ultimate goal is to install it as a
shared assembly in the gac.
> 
> Where did you end up putting the .snk file to get it to build? It
> sounds like the .snk file needs to be in two different locations
> depending on whether you're building the complete source or just the
> extensions. Is that the case?

That is not the case. Oddly enough, where I ended up placing it was
one directory higher than the base log4net directory. So let's say I
have the log4net directory which, in turn, contains all the
extensions, src, bin, etc. directories in a directory called
"usefull_stuff"... well I ended up putting the key file in that
"usefull_stuff" directory! It was totally odd that it could find it
there without the assembly file pointing there (which it is most
definitely not).

To recap (I'm not sure how clear I was in the original email) I was
just miscounting where the file should go and then, in desperation,
starting going up one directory at a time until it worked. Rather than
let me get to root and still not work, for some odd reason it worked
at one directory above the log4net base directory.

> At first glance, I would have thought the
> .snk needs to be in the root /src folder and everything knows to find
> it there. It sounds like that's not the case.

No, the starting point would be %Project
Directory%\obj\<configuration> just as the assembly file default
comments say. So, in the case of the core log4net assembly that was
log4net\src\obj\Release and for the EventID extension that was
log4net\extensions\net\1.0\log4net.Ext.EventID\cs\src\obj\Release.
Then each of those specified that I go up 3 and 4 directories,
respectively, which puts the log4net key file in the log4net directory
(alongside the log4net.snk.readme file...) and the EventID one in the
log4net\extensions\net\1.0\log4net.Ext.EventID.

The only other hitch I ran up against was I needed to have built a
strongly named version of log4net first and made sure to redefine the
reference in the log4net.Ext.EventID project to point to that strongly
named log4net assembly. Only then could I put both of those assemblies
in the gac and have my test app log successfully. It makes sense, but
I just wasn't thinking of it since the extension project already had a
reference set up. :)

-- 
533777336444244