Microsoft .NET Finally Offers a General Purpose Zip Library
The .NET Framework has always had a weird relationship with the Zip file format. From the very beginning .NET actually did support Zip files, but in a way most people didn’t realize. The long since abandoned J# programming language included Java’s java.util.zip package. In a 2003 article by Ianier Munoz, one can see how to use J# Zip libraries in C#.
.NET 2.0 was very much a step backwards in this area. By then J# was already largely forgotten by the developer community and instead we were offered the nearly useless IO.Compression namespace. The DeflateStream and GZipStream classes only offered single pass, stream-based compression. Furthermore they lack the ability to handle the metadata associated with multiple file archives such as Zip.
In 2006 Microsoft offered an uncharacteristically clumsy API for Zip files via the ZipPackage class. This API was created mainly to support the Open XML Paper Specification (XPS). The XPS was originally seen as an attempt to compete directly with Adobe’s PDF file format, but those efforts have been largely abandoned. Today XPS is used for the Windows print spooler, replacing the GDI-based WinPrint if the printer supports it.
For .NET 4.5 we are finally seeing a built-in API for Zip files worth looking at. While it is still too soon to tell if the ZipArchive class is a real competitor to libraries such as DotNetZip, it at least offers something usable to those who are unable to use open source libraries due to licensing issues. Tugberk Ugurlu has a walkthrough showing how to use ZipArchive in .NET 4.5.
Iordanis Giannakakis, Savvas Dalkitsis Aug 28, 2015