How do I ZIP a file in C#, using no 3rd-party APIs?
How can I programatically (C#) ZIP a file (in Windows) without using any third party libraries? If using the 4.5+ Framework, there is now the ZipArchive and ZipFile classes. using (ZipArchive zip = ZipFile.Open(“test.zip”, ZipArchiveMode.Create)) { zip.CreateEntryFromFile(@”c:\something.txt”, “data/path/something.txt”); } You need to add references to: System.IO.Compression System.IO.Compression.FileSystem For .NET Core targeting net46, you need to … Read more