Search code examples
c#.netdotnetzip

DotNetZip does not extract Best compression from WinZip


I have created a very simple program in C# using the DotNetZip dll. I am trying to extract a zip file that chooses the best compression. Here is the code.

static void Main(string[] args)
    {
        string nameOfFile = "testBest.zip";
        string directory = "testBest";

        Console.WriteLine("Extracting file {0} to {1}", nameOfFile, directory); 

        using (ZipFile zip = ZipFile.Read(nameOfFile))
        {
            foreach (ZipEntry e in zip)
            {
                e.Extract(directory, ExtractExistingFileAction.OverwriteSilently);
            }
        }
    }

And the error says one of the txt files uses an unsupported compression method.

Can the DotNetZip library not extract zip files when using Best compression? Is there a way to handle this? What are the alternatives?


Solution

  • I would imagine that the zip compression being used is not one of the supported ones. Here is an example forum post where this was the case: http://dotnetzip.codeplex.com/discussions/64680

    In this case, the compression of DEFLATE64 was used instead of DEFLATE, giving the same error you are seeing. While your entire error text would be more helpful, it will probably come down to the same thing - the library does not support your compression method.