How to work with RAR-archives in C#?

From time to time, the task is to pack something, unpack it, and simply make an automatic storage unit.

Collecting a selection of libraries:

1. SharpCompress

SharpCompress is a fully managed C# library to deal with many compression types and formats.

2. SevenZipSharp

Managed 7-zip library written in C# that provides data (self-)extraction and compression (all 7-zip formats are supported). It wraps 7z.dll or any compatible one and makes use of LZMA SDK.

3. SevenZipLib

SevenZipLib is a lightweight, easy-to-use managed interface to the 7-zip library.

4. Rar.exe – via the command line

There is an option – via the command line – rar.exe with parameters, their description in a file that comes with winrar.

5. 7z.dll – C# (.net) interface for 7-Zip archive dlls

7-Zip is open-source archive program with plug-in interface. New archive formats and/or archive codecs can be added by dlls. 7-Zip ships with several archive formats preinstalled:

  • 7z – its own format features good compression (LZMA, PPMd) but can be slow in terms of packing/unpacking
  • Packing / unpacking: ZIP, GZIP, BZIP2 and TAR
  • Unpacking only: RAR, CAB, ISO, ARJ, LZH, CHM, Z, CPIO, RPM, DEB and NSIS

7. NUnrar – Unrar in pure C#

NUnrar is a native C# unrar library that supports forward-only (i.e. Network) streams and Silverlight. No intermediate buffering necessary. Random access is also available. It was ported from the JUnrar version of unrar ( by Edmund Wagner.

8. SharpCompress – a fully native C# library for RAR, 7Zip, Zip, Tar, GZip, BZip2

SharpCompress is a compression library in pure C# for .NET Standard 1.3 and 2.0 that can unrar, un7zip, unzip, untar unbzip2 and ungzip with forward-only reading and file random access APIs. Write support for zip/tar/bzip2/gzip are implemented.

The major feature is support for non-seekable streams so large files can be processed on the fly (i.e. download stream).

Bookmarks for reading

there are code samples:

About: Morozov Dmitry

My specialisation is software engineer. I am 35 years old and have been working in the IT field for over 15 years. I have accumulated experience in programming, project management, training and administration.