This project is read-only.

KeyNotFoundException when appending files

Nov 11, 2010 at 12:40 PM


I am trying to create an archive and then append files to it.

My code looks something like this:

 SevenZipCompressor comp = new SevenZipCompressor();

 comp.ArchiveFormat = OutArchiveFormat.Zip;

comp.DirectoryStructure = false;

Then, I scan through files. If the archive does not exist I leave the default "create" on and just do:

comp.CompressFiles(destZip, decodedFilePath);

If it does exist I do:

comp.CompressionMOde = SevenZip.CompressionMode.Append;

and then:

 comp.CompressFiles(destZip, decodedFilePath);

When running this, it throws and exception when trying to compress the second file into the zip.

The exception is:

KeyNotFoundException: The given key was not present in the dictionary.

Any help would be appreciated.