I’m trying to get this script to extract a .zip file into a folder.
Here’s the code I have:
string zipToUnpack = "New folder.zip";
string unpackDirectory = "files2";
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 using references are:
using System;
using System.Windows.Forms;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Net;
using System.IO.Compression;
When I try to compile this, I get this error:
code.cs(120,16): error CS0246: The type or namespace name ‘ZipFile’ could not be
found (are you missing a using directive or an assembly reference?)
code.cs(120,31): error CS0103: The name ‘ZipFile’ does not exist in the current
context
If I have to add a reference or something, PLEASE show me how with code because I don’t know how and I don’t like to use Visual Studio to add references.