Cannot add file - corrupts the zipfile

Aug 9, 2012 at 12:22 AM

This should be simple - I'm adding a file, but when I call ZipFile.Checkzip, it gives me a "The given key was not present in the dictionary" exception. Any ideas?

            using (ZipFile zip = ZipFile.Read("MyFile.zip"))
            {
                ZipEntry f = zip.AddFile(file, "Install");
                f.FileName = "Install\\license.license";
                zip.Save();
            }

            bool isOk = ZipFile.CheckZip("MyFile.zip");


Aug 9, 2012 at 9:41 PM

I found a solution. I extract the zip file to a temp folder, add my license file in the appropriate directory, the zip everything back up. It works, but I don't see anything wrong with the original code.