string zipFilePath = @"d: est.zip"; string file1 = @"D:门头照处理门店照片2018-3-19 wuxl门店照片105500035102.jpg"; string file2 = @"D:门头照处理门店照片2018-3-19 wuxl门店照片105500107146.jpg"; // 创建并添加被压缩文件 using (FileStream zipFileToOpen = new FileStream(zipFilePath, FileMode.Create)) using (ZipArchive archive = new ZipArchive(zipFileToOpen, ZipArchiveMode.Create)) { archive.CreateEntryFromFile(file1, "a.jpg"); archive.CreateEntryFromFile(file2, "b.jpg"); }
-
项目要引用System.IO.Compression,System.IO.Compression.FileSystem
要添加using System.IO.Compression;