I am using Ionic.Zip.dll from the DotNetZip library and I am trying to delete the ZIP file after the decompression is complete, but I cannot do this.
Here is the code I have:
using (ZipFile zip = ZipFile.Read(nextVersion + ".zip"))
{
zip.ExtractAll(Directory.GetCurrentDirectory(), ExtractExistingFileAction.OverwriteSilently);
try
{
File.Delete(nextVersion + ".zip");
}
catch (Exception)
{
MessageBox.Show("Could not delete ZIP!");
Environment.Exit(1);
}
}
What am I doing wrong here?
source
share