5

I got the following error when I try to extract a zip file: "SevenZip.SevenZipArchiveException: Invalid archive: open/read error! Is it encrypted and a wrong password was provided? If your archive is an exotic one, it is possible that SevenZipSharp has no signature for its format and thus decided it is TAR by mistake."

Nothing works with zip files, but everything works fine with 7z files. Is it possible to extract zip files with the SevenZipExtractor?

string sourcePath = @"c:/temp/yyy.zip";
using (var file = new SevenZipExtractor(sourcePath))
{
   file.ExtractArchive(outputPath);
}
rocketman
  • 106
  • 1
  • 5
  • I am running into the same issue. I will post back here if I find a solution... If anyone has any pointers, it'd be much appreciated :) – Nathan Bills Aug 10 '16 at 15:44
  • Normally you are able to extract zip files with the SevenZipExtractor. It worked for me with Windows 2008R2 and 7zip 16.2. But I run into the same problem after upgrading to 2012R2 and 7zip 16.4. Didn't find a solution yet! :( – kwrl Apr 04 '17 at 13:49
  • Same problem, trying to use SevenZipSharp as nuget, and it fails to extract files with a .zip extension. Used to work fine with old DLLs but its unclear what version they are. – Anthony Brien Jul 17 '19 at 15:07

3 Answers3

0

What I found with this error when I encountered it was that it was an issue when I would attempt to decompress a certain set of files. For example, if you were to run the SevenZipCompressor and say it stopped halfway through, this would corrupt the compression of said files, so when you would attempt to decompress the files, the error would occur.

The fix for me was to recompress the set of files and to be sure it ran completely, and then the error went away, allowing the extraction to work.

So the moral of the issue at hand is to look at the source in this case and make sure the files or the archive aren't corrupt.

spatial_coder
  • 95
  • 1
  • 10
0

I've run into the same issue recently with version 18.5.0.

Downgrading the package to 9.38.3 solved the problem for me.

Grabofus
  • 1,924
  • 14
  • 17
0

For people still running into this problem: this can also happen when trying to uncompress rar5 files that have filename encrypted turned on.

Rickert
  • 120
  • 7