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 Radovan Raszka <ra...@hasam.cz> on 2010/02/10 10:15:09 UTC

Problem compile log4net for NETCF 2.0

Hello,
This question is probably for developer forum, but I'm unable to
subscribe it (no response for subscribe request)

I'd like to compile log4net from current source for Compact framework
2.0, but wasn't succesfull, I got these error from Nant:

compile-netcf-2.0:

      [csc] Compiling 216 files to
'F:\server\devdata\log4net-svn\bin\netcf\2.0\debug\log4net.dll'.
      [csc]
f:\server\devdata\log4net-svn\src\Core\LocationInfo.cs(277,10): error
CS0246: The type or namespace name 'StackFrame' could not be found (are
you missing a using directive or an assembly reference?)
      [csc]
f:\server\devdata\log4net-svn\src\Core\LocationInfo.cs(291,20): error
CS0246: The type or namespace name 'StackFrame' could not be found (are
you missing a using directive or an assembly reference?)

BUILD FAILED

F:\server\devdata\log4net-svn\log4net.build(427,14):
External Program Failed:
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe (return code was
1)

I checked documentation and found that StackFrame class is not supported
in compact framework.... What to do now?
I got sources from http://svn.apache.org/repos/asf/logging/log4net/trunk
- is it correct path?
Or is it possible to get binary for CF 2.0? Zip file avalable on the
download page contains only binary for CF 1.0

Radovan Raszka

Re: Problem compile log4net for NETCF 2.0

Posted by assar <m....@gmail.com>.
The only supported compact framework version is NETCF 1.0 (see 
http://logging.apache.org/log4net/release/framework-support.html here ) try
compiling it for NETCF 1.0 and it should do ok,for example if you use VS for
compiling it, then in the project properties->Build change the conditional
compilation symbols from "NET; NET_1_0" (or whatever) to "NETCF; NETCF_1_0"
and build.


Radovan Raszka wrote:
> 
> Hello,
> This question is probably for developer forum, but I'm unable to
> subscribe it (no response for subscribe request)
> 
> I'd like to compile log4net from current source for Compact framework
> 2.0, but wasn't succesfull, I got these error from Nant:
> 
> compile-netcf-2.0:
> 
>       [csc] Compiling 216 files to
> 'F:\server\devdata\log4net-svn\bin\netcf\2.0\debug\log4net.dll'.
>       [csc]
> f:\server\devdata\log4net-svn\src\Core\LocationInfo.cs(277,10): error
> CS0246: The type or namespace name 'StackFrame' could not be found (are
> you missing a using directive or an assembly reference?)
>       [csc]
> f:\server\devdata\log4net-svn\src\Core\LocationInfo.cs(291,20): error
> CS0246: The type or namespace name 'StackFrame' could not be found (are
> you missing a using directive or an assembly reference?)
> 
> BUILD FAILED
> 
> F:\server\devdata\log4net-svn\log4net.build(427,14):
> External Program Failed:
> c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe (return code was
> 1)
> 
> I checked documentation and found that StackFrame class is not supported
> in compact framework.... What to do now?
> I got sources from http://svn.apache.org/repos/asf/logging/log4net/trunk
> - is it correct path?
> Or is it possible to get binary for CF 2.0? Zip file avalable on the
> download page contains only binary for CF 1.0
> 
> Radovan Raszka
> 
> 

-- 
View this message in context: http://old.nabble.com/Problem-compile-log4net-for-NETCF-2.0-tp27528222p30413542.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

RE: Problem compile log4net for NETCF 2.0

Posted by Radovan Raszka <ra...@hasam.cz>.
I have read documentation once more in deep and tried again with fresh sources from svn.
 
I have created new CF2.0 project (target device WindowsCE, CF 2.0, project type: class library) and added all source codes as mentioned in documentation.
Still no succes, StackFrame class used in LocationInfo.cs is not a part of CF. So I added some #if !NETCF to not use this class in CF build.
But some other classes are using StackFrame defined in LocationInfo (StackTraceDetailPatternConverter and StackTracePatternConverter). Because of this, I have detached there classes from CF project and skipped them in PatternLayout static constructor by #if !NETCF.
 
Compilation error count decreased significantly, so I did last reparations in FileAppender (CF doesn't support friendlyname for mutex) and RollingFileAppender (GetLastWriteTimeUtc not supported in CF) and it compiles without problems !!!
 
According to source code I guess that CF version is not built during development and changes in code even aren't checked against compact framework (!), what is surprising - nobody need to use log4net on WinCE or similar embedded/mobile platform?
If someone from development team is interested, I can provided CF project file with all my modifications in existing code.
 
Radovan Raszka


________________________________

Od: Radovan Raszka [mailto:raszka@hasam.cz] 
Odesláno: 11. února 2010 12:33
Komu: Log4NET User
Předmět: RE: Problem compile log4net for NETCF 2.0


even when compiled sucessfully, it has some unacceptable side effects. It compiles using .NET 2.0, not using CF 2.0 what leads that some .NET 2.0 libraries are deployed to my Win CE device. It is not possible as disk space is insufficient. So I finally compiled it from cmd line using CF 2.0, but resulting DLL doesn't work - see my code:
 
log4net.Appender.RollingFileAppender fa = new log4net.Appender.RollingFileAppender();

fa.AppendToFile = true;

fa.File = "hh.log";

fa.Layout = new log4net.Layout.PatternLayout("%date{dd-MM-yyyy HH:mm:ss} [%5level] %message%n"); <-- here is Exception thrown saying: Could not load type 'System.Diagnostics.StackFrame' from assembly 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=969DB8053D3322AC'.

fa.RollingStyle = log4net.Appender.RollingFileAppender.RollingMode.Date;

fa.Threshold = log4net.Core.Level.Debug;

fa.ActivateOptions();

log4net.Config.BasicConfigurator.Configure(fa);

log4net.ILog log = log4net.LogManager.GetLogger(this.GetType());

It seems that there is still dependency on StackFrame class which is not a part of CF 2.0. Was anybody able to compile working log4net for CF 2.0 ? I looks like vey tricky task...
RR
 

RE: Problem compile log4net for NETCF 2.0

Posted by Radovan Raszka <ra...@hasam.cz>.
even when compiled sucessfully, it has some unacceptable side effects. It compiles using .NET 2.0, not using CF 2.0 what leads that some .NET 2.0 libraries are deployed to my Win CE device. It is not possible as disk space is insufficient. So I finally compiled it from cmd line using CF 2.0, but resulting DLL doesn't work - see my code:
 
log4net.Appender.RollingFileAppender fa = new log4net.Appender.RollingFileAppender();

fa.AppendToFile = true;

fa.File = "hh.log";

fa.Layout = new log4net.Layout.PatternLayout("%date{dd-MM-yyyy HH:mm:ss} [%5level] %message%n"); <-- here is Exception thrown saying: Could not load type 'System.Diagnostics.StackFrame' from assembly 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=969DB8053D3322AC'.

fa.RollingStyle = log4net.Appender.RollingFileAppender.RollingMode.Date;

fa.Threshold = log4net.Core.Level.Debug;

fa.ActivateOptions();

log4net.Config.BasicConfigurator.Configure(fa);

log4net.ILog log = log4net.LogManager.GetLogger(this.GetType());

It seems that there is still dependency on StackFrame class which is not a part of CF 2.0. Was anybody able to compile working log4net for CF 2.0 ? I looks like vey tricky task...
RR


________________________________

Od: Radovan Raszka [mailto:raszka@hasam.cz] 
Odesláno: 11. února 2010 7:54
Komu: Log4NET User
Předmět: RE: Problem compile log4net for NETCF 2.0


I did some researches and sources seems to be good - if I set NETCF;NETCF_2_0 conditional compilation symbols, log4net for CF 2.0 compiles without errors. Probably there is some mistake in Nant build script
RR

________________________________

Od: Radovan Raszka [mailto:raszka@hasam.cz] 
Odesláno: 10. února 2010 10:15
Komu: Log4NET User
Předmět: Problem compile log4net for NETCF 2.0



Hello, 
This question is probably for developer forum, but I'm unable to subscribe it (no response for subscribe request) 

I'd like to compile log4net from current source for Compact framework 2.0, but wasn't succesfull, I got these error from Nant:

compile-netcf-2.0: 

      [csc] Compiling 216 files to 'F:\server\devdata\log4net-svn\bin\netcf\2.0\debug\log4net.dll'. 
      [csc] f:\server\devdata\log4net-svn\src\Core\LocationInfo.cs(277,10): error CS0246: The type or namespace name 'StackFrame' could not be found (are you missing a using directive or an assembly reference?)

      [csc] f:\server\devdata\log4net-svn\src\Core\LocationInfo.cs(291,20): error CS0246: The type or namespace name 'StackFrame' could not be found (are you missing a using directive or an assembly reference?)

BUILD FAILED 

F:\server\devdata\log4net-svn\log4net.build(427,14): 
External Program Failed: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe (return code was 1) 

I checked documentation and found that StackFrame class is not supported in compact framework.... What to do now? 
I got sources from http://svn.apache.org/repos/asf/logging/log4net/trunk <http://svn.apache.org/repos/asf/logging/log4net/trunk>  - is it correct path? 
Or is it possible to get binary for CF 2.0? Zip file avalable on the download page contains only binary for CF 1.0 

Radovan Raszka 


RE: Problem compile log4net for NETCF 2.0

Posted by Radovan Raszka <ra...@hasam.cz>.
I did some researches and sources seems to be good - if I set NETCF;NETCF_2_0 conditional compilation symbols, log4net for CF 2.0 compiles without errors. Probably there is some mistake in Nant build script
RR

________________________________

Od: Radovan Raszka [mailto:raszka@hasam.cz] 
Odesláno: 10. února 2010 10:15
Komu: Log4NET User
Předmět: Problem compile log4net for NETCF 2.0



Hello, 
This question is probably for developer forum, but I'm unable to subscribe it (no response for subscribe request) 

I'd like to compile log4net from current source for Compact framework 2.0, but wasn't succesfull, I got these error from Nant:

compile-netcf-2.0: 

      [csc] Compiling 216 files to 'F:\server\devdata\log4net-svn\bin\netcf\2.0\debug\log4net.dll'. 
      [csc] f:\server\devdata\log4net-svn\src\Core\LocationInfo.cs(277,10): error CS0246: The type or namespace name 'StackFrame' could not be found (are you missing a using directive or an assembly reference?)

      [csc] f:\server\devdata\log4net-svn\src\Core\LocationInfo.cs(291,20): error CS0246: The type or namespace name 'StackFrame' could not be found (are you missing a using directive or an assembly reference?)

BUILD FAILED 

F:\server\devdata\log4net-svn\log4net.build(427,14): 
External Program Failed: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe (return code was 1) 

I checked documentation and found that StackFrame class is not supported in compact framework.... What to do now? 
I got sources from http://svn.apache.org/repos/asf/logging/log4net/trunk <http://svn.apache.org/repos/asf/logging/log4net/trunk>  - is it correct path? 
Or is it possible to get binary for CF 2.0? Zip file avalable on the download page contains only binary for CF 1.0 

Radovan Raszka