I need to compress a file as 7zip using SharpCompress: http://sharpcompress.codeplex.com
what I have done as follows:
using (var archive = ZipArchive.Create())
{
archive.AddEntry("CompressionTest.pdb", new FileInfo("CompressionTest.pdb"));
using (Stream newStream = File.Create("CompressionTest212.7z"))
{
archive.SaveTo(newStream, SharpCompress.Common.CompressionType.LZMA);
}
}
The compression process is done successfully. However, the compressed file can not be extracted either using 7z (http://www.7-zip.org/download.html) or winrar.
I dont know if somebody also got the same problem and had an idea how to solve it?
Thanks in advance.
SharpCompress doesn't support 7zip compression. Only decompression, see: http://sharpcompress.codeplex.com/ ( Supported Format Table )
You can use the native library of 7zip for compression, or use an opensource wrapper around it like: http://sevenzipsharp.codeplex.com/