Category Archives: Compact Framework

Connecting VS.NET to Windows CE

My current contract is a Compact Framework application for a LXE device running Windows CE 4.2. I was having some issues connecting to it from VS.NET and so I asked my good friend Google what he knew about it with this query – http://www.google.com/search?hl=en&q=VS.NET+Compact+Framework+Device+Connection+Issue. Wouldn’t you know that it pops up with my good friend Doug Reilly when he posted about VS.NET Compact Framework Deployment Issues. It turns out that I didn’t have the exact same issue as Doug, but it did fix me because in the download that me pointed me to (Windows CE Utilities for Visual Studio .NET 2003 Add-on Pack 1.1). In there they mentioned that you have to configure VS.NET for the processor type that you are using with Windows CE with ActiveSync.

That’s a real pain, but it fixed me…

Deployment issues with the Compact Framework v2.0… (Sorta)

I just tried to deploy an application to a customer’s PPC device and was very frustrated because the app looked like it installed and even put a shortcut in the “Program Files”. However, when I clicked on it, nothing happened. No error message, nothing. Just silence. Wow, that’s informative. The good news is that I called John Hopkins, one of my sub-contractors, and he asked something about the framework version and it hit us both – v2.0 of the Compact Framework was not on the device. Install it and it works great now… 🙂

The thing that made this blogworthy was the lack of error messages. That was the astounding thing. I’d expect some error message on install or something that would prompt me that I needed to install something else. Oh well. I guess that we can’t have everything. It’s a fabulous environment to develop in and is light years ahead of previous development environments so I’m grateful for that but it just points out this type of little inconstancy that much more.

log4net on the Compact Framework

I was reminded of log4net today when working on a project. The client asked a logging framework and the cool part is that it’s a Compact Framework application. Sure enough log4net supports the Compact Framework.

There are a couple of minor differences that you should be aware of if you are interested in using log4net on the Compact Framework. First of all, not all of the appenders make sense – like the RemotingAppender, the EventLogAppender and the OracleAppender. Secondly, there is no mechanism for retrieving assembly level attributes so you have to explicitly initialize and shut down the log4net engine.

 

static void Main()

{

      try

      {

            //This line configures the log4net engine.

log4net.Config.DOMConfigurator.Configure(

new FileInfo(@”\log4net.config”));

 

            frmLogin loginForm = new frmLogin ();

            loginForm.ShowDialog();

                  Application.Run(new frmMain());

            }

      }

      catch (System.Exception e)

      {

            _log.Error(“Main“, e);

      }

      finally

      {

            //This line shuts down the log4net engine

            log4net.LogManager.Shutdown();

      }

}

 

The other thing that was interesting is that the online help on http://logging.apache.org/log4net showed conversion patterns with %message%newline to print the message and then put a newline in the file. I had to use %m%n because the first one there printed as

 

My stringessage

ewline

 

which was not quite what was expected.

 

Have fun with log4net, it’s a great lightweight logging framework for the compact framework.