"an item with the same key has already been added" when using "AddSelectedFiles"

Sep 23, 2012 at 9:59 AM

Hi all,

I'm working on an existing zip archive, and trying to save changes to it.

One of the operations I do during the save, is to add the content of some directory, again and again every time I save.

I get "an item with the same key has already been added" exception when using AddSelectedFiles:

_zipFile.AddSelectedFiles(excludeList, dirPath, "", true);

It is possible that some entries that the save is now adding, already exist, obviously, but I just want to add them anyway but I didn't see how I can overwrite them.

BTW, when the zip file is a new one, and doesn't contain any entries, there's no problem.

Any idea how to solve this?

Thanks.