How can we create zip file in .NET Framework 4.5 ?

Upto .NET Framework 4.5 we cannot create .zip files. In .NET Framework 4.5
it is now possible. Following is example for creating zip file and extracting zip file
from and to folder.

use the namespace-
using System.IO.Compression;

To zip

ZipFile.CreateFromDirectory(@"path of FolderToCompress",@"Path of FolderToCompress.zip");

To unzip

ZipFile.ExtractToDirectory(@"Path of FolderToCompress.zip", @"path of FolderToCompress/UnzippedData");
Need Help? Contact Us.

Log in

*
*

Forgot password?

*

New User

*
*
*
*