Search code examples
c#sharpziplib

Extra data extended Zip64 information length is invalid


I need to change a ZIP file, add/replace files to the archive. I’m trying to use SharpZipLib 3rd party library. When calling ZipFile.CommitUpdate(), I receive an exception “Extra data extended Zip64 information length is invalid”.

Here’s the call stack:

ZipEntry.ProcessExtraData(bool localHeader)
ZipFile.ReadEntries()
ZipFile.Reopen(System.IO.Stream source)
ZipFile.RunUpdates()
ZipFile.CommitUpdate()

The zip entry being processed is just a first entry; it was already there before I’ve changed anything.

Because the problematic ZIP file contains the “[Content_Types].xml” entry, I assume it was created by System.IO.Packaging.ZipPackage .NET class.


Solution

  • .NET Framework 4.5 has a functionally equivalent System.IO.Compression.ZipFile class.

    Unlike open source SharpZipLib, this one works OK.

    You need to reference System.IO.Compression and System.IO.Compression.FileSystem framework assemblies.