ELSheepO
ELSheepO

Reputation: 305

How to use DotNetZip

I've downloaded DotNetZip from codeplex and I am totally lost as to what to do next.

I want to extract a .zip archive

I know I use something like this

string zipToUnpack = "C1P3SML.zip";
string unpackDirectory = "Extracted Files";
using (ZipFile zip1 = ZipFile.Read(zipToUnpack))
{
    // here, we extract every entry, but we could extract conditionally
    // based on entry name, size, date, checkbox status, etc.  
    foreach (ZipEntry e in zip1)
    {
      e.Extract(unpackDirectory, ExtractExistingFileAction.OverwriteSilently);
    }
}

My question is, what project do I add and/or what references do I add?

Thanks

Upvotes: 2

Views: 18201

Answers (1)

Charleh
Charleh

Reputation: 14002

Just add a reference to Ionic.Zip.dll - you do need to make sure you are using the right reference for your target framework version (silverlight, WPF etc)

Then the above code should work assuming you import the Ionic namespace

Also not sure what you mean by 'what project should I add' - you already have a project right, or is this just a test project and you need to create a new project? If so any project type will do - but the best tests are either a console app or a forms/wpf app

Upvotes: 7

Related Questions