SharpZipLib のクラス FastZip を使用して zip ファイルを作成していますが、プログラムを閉じた後、次の理由でファイルを削除できません。
「zip.zip を削除できません: 別の人またはプログラムによって使用されています。ファイルを使用している可能性のあるプログラムをすべて閉じて、もう一度やり直してください。」
ファイルを生成するコードは次のとおりです。
fZip.CreateEmptyDirectories = true;
fZip.CreateZip(filesPath + "\\" + this.zipName, filesPath, false, this.zipFilter);
私は使用してみました:
using (FastZip fZip = new FastZip())
{
try
{
fZip.CreateEmptyDirectories = true;
fZip.CreateZip(filesPath + "\\" + this.zipName, filesPath, false, this.zipFilter);
}
catch (Exception)
{
}
}
ただし、iDisposable には変換されません。