I have seen many tutorials on how to compress a single file in c#. But I need to be able to create a normal *.zip file out of more than just one file. Is there anything in .NET that can do this? What would you suggest (baring in mind I'm under strict rules and cannot use other libraries)
Thank you
You can try SharpZipLib for that. Is is open source, platform independent pure c# code.
Edit: if you're using .Net 4.5 or later this is built-in to the framework
For earlier versions or for more control you can use Windows' shell functions as outlined here on CodeProject by Gerald Gibson Jr.
I have copied the article text below as written (original license: public domain)
This can be done by adding a reference to System.IO.Compression and System.IO.Compression.Filesystem.
A sample createZipFile() method may look as following:
where
More details about ZipFile Class in MSDN
This can be done with just one line of code using just Dot Net. Below is sample code copied from MSDN
Step 1: Add a reference to System.IO.Compression.FileSystem
Step 2: Follow the code below
.NET has a built functionality for compressing files in the System.IO.Compression namespace. Using this you do not have to take an extra library as a dependency. This functionality is available from .NET 2.0.
Here is the way to do the compressing from the MSDN page I linked: