I would like to zip a folder containing files and subfolders in VB.NET. My solution targets .NET 4.0 Client Profile.
I see that there is a ZipFile class for .NET 4.5, and System.IO.Packing for .NET 4.0 (but not Client Profile). So, those won't help. I note that there is also a GZipStream class, but I never see .gz files floating around, so not sure if that's a good approach. I would prefer a basic .zip file that I know my users can work with.
There are a handful of third-party solutions, such as http://icsharpcode.github.io/SharpZipLib/, but I assume they are far more bloated than the 10-20 lines of code I am looking for. Maybe that's the right answer...I don't know.
Just hoping for a few lines of VB.NET code to zip some files in a solution targeting .NET 4.0 CP.
Create ZIP from "source" folder.
Imports System.IO.Compression
ZipFile.CreateFromDirectory("source","destination.zip",CompressionLevel.Optimal,False)
Extract ZIP to "destination" folder.
ZipFile.ExtractToDirectory("destination.zip","destination")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With