I'm trying to compile this simple code in my C# WinForms project in VS 2010:
using System.IO;
using System.IO.Compression;
string zipPath = @"c:\example\start.zip";
string extractPath = @"c:\example\extract";
using (ZipArchive archive = ZipFile.OpenRead(zipPath))
{
foreach (ZipArchiveEntry entry in archive.Entries)
{
if (entry.FullName.EndsWith(".txt", StringComparison.OrdinalIgnoreCase))
{
entry.ExtractToFile(Path.Combine(extractPath, entry.FullName));
}
}
}
The description for the ZipFile Class tells me that I need to add System.IO.Compression.FileSystem
assembly. Sorry for this question, but where the heck is it? Does it come as a DLL? It is not in the list of the .NET references, and I know for sure that I have .NET Framework v.4.5 installed.
EDIT: Whoever wants to include a simple Zip archive support in your VS 2010 project, I found this project that compiles right into your own project. Very clean and simple.