7z libraries for C#
.NET has no 7z support in the base class library (System.IO.Compression handles only ZIP, GZip, Brotli and, since .NET 7, TAR). Two open-source libraries cover 7z:
- SharpCompress is pure managed code and runs everywhere .NET runs. It reads 7z archives with LZMA, LZMA2, PPMd, BZip2, Deflate and BCJ/BCJ2, including AES-encrypted ones, and writes non-solid LZMA/LZMA2 archives. The same API handles ZIP, RAR (read), TAR, GZip and more.
- SevenZipExtractor wraps the native
7z.dlland ships it in the NuGet package. It reads every format 7-Zip reads, with 7-Zip’s speed, but it’s Windows only and can’t create archives.
Pick SharpCompress for cross-platform code and for creating archives; SevenZipExtractor when you only extract on Windows and want 7-Zip’s full format and method support.
Squid-Box.SevenZipSharp, a wrapper that could also create archives through 7z.dll, was archived by its maintainer in 2024 and gets no more fixes.
- SevenZipExtractor SevenZipExtractor is a C# wrapper of 7z.dll for extracting 7z archives on Windows. How to install it, extract all files.
- SharpCompress SharpCompress is a pure .NET library that reads and writes 7z archives. How to install it, extract a 7z file, read entries into memory.