BT

InfoQ Homepage News Microsoft .NET Finally Offers a General Purpose Zip Library

Microsoft .NET Finally Offers a General Purpose Zip Library

Bookmarks

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.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.