user3770833 user3770833 - 1 year ago 209
C# Question

How to add Ionic.Zip.dll in project and use it to create a zip from folder?

I am new to using Visual studio 2010 Express. I have got an assignment to create a zip file from the folder which contains image files and some text files. I have been given

to use to zip the folder. But i dont know from where to start.
I have created a c# project and a function that takes a path of folder and returns path of
file. I dont know how to add this dll in to my project and how to use it.I have found many code snippets ,but how to start of ...

Following is the function that i am preparing to make a zip:

public static String Zip(String folderPath)
String zipFilePath = null;

catch (Exception ex)
MessageBox.Show("" + ex.Message, "LN Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
return zipFilePath;

So please , help to start of . .
Thank you in advance . .

Answer Source

To add a reference, right click on your project and select Add Reference

enter image description here

Then browse and add the file

enter image description here

Then here is basic code that shows you how to add a file to the zip

 using (ZipFile zip = new ZipFile())


Where the dots are in the code sample above, use intellisense and fill out the required parameters.

We are not here to do your entire assignment for you but this will help get you started.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download