.NET Compact Framework Applications

DotNetZip

DotNetZip works with the .NET Compact Framework

There is a special version of DotNetZip, specifically built for the .NET Compact Framework v2.0 or v3.5.

The programming model is exactly the same as for the regular DotNetZip library. There are a few features not supported in the CF version of DotNetZip:

  1. Self-extracting archives. The ZipFile.SaveSelfExtractor() method is not available in the CF version of DotNetZip. There's no strong technical reason for this limnitation; I just didn't think it would be of mainstream interest, and in order to keep the size of the library down, I omitted that part from the CF version. It amounts to about a 120k savings.
  2. WinZip AES encryption. The CF version does not support encryption using WinZipAes128 or WinZipAes256. This is because the crypto classes from the .NET Framework are not available on .NET CF. I would have to write my own SHA1HMAC() and so on, which I haven't got 'round to doing, especially because no one is clamoring for it.
  3. ParallelDeflateStream. Most mobile devices do not use multicore processors, so a parallel deflater would offer no benefit. Even aside from that, parallel deflation shows its strength when cmopressing larger files, and when larger memory resources are available. Both of these are unlikely in .NET CF applications.

Using DotNetZip in a Smart Device project

To build a smart device application that uses DotNetZip, you will need to use Visual Studio 2008 or later.

  1. Open Visual Studio 2008.
  2. Create a smart device project. Specify that it will use the .NET Compact Framework v2.0 or v3.5.
  3. Add a Reference to the CF Library for DotNetZip. The filename is Ionic.Zip.CF.dll
  4. Build your application as normal.

About the Project Design

If you are a developer who wants to modify or extend the DotNetZip library itself, the following may be of interest.

The CF-Library project in the DotNetZip source distribution includes all of the source files as Links to the original files in the Library project. This means, the source files are not duplicated. Any changes need to be made only once. The CF-Library project is simply a "build project" in that regard. There is no additional source code specifically for the .NET Compact Framework.

NETCF is defined as a conditional compile symbol for the CF-Library project. This symbol is used in the source to exclude code that will not run on the .NET Compact Framework, for example, the calls to SetLastModifiedTime() method on the System.IO.File class.