ZipFile.CreateFromDirectory throws System.IO.IOException : The process cannot access the file X because it is being used by another process
<p>Actually I'm trying to create zip file of a directory and but the <code>ZipFile.CreateFromDirectory()</code> giving below Exception.</p>

<blockquote>
  <p>System.IO.IOException :   The process cannot access the file
  PATH_TO_CREATE_ZIP/file.zip' because it is being used by another
  process.</p>
</blockquote>

<p>Following is the Code Snippet for it. :</p>

<pre><code>public void createZipFile(string zipPath, string archiveFileName)
{
    string DirectoryToBeArchive = zipPath + "\\" + archiveFileName;

    if (Directory.Exists(DirectoryToBeArchive + ".zip"))
    {
        File.Delete(DirectoryToBeArchive);
        ZipFile.CreateFromDirectory(zipPath, DirectoryToBeArchive + ".zip", CompressionLevel.Fastest, false);
    }
    else
        ZipFile.CreateFromDirectory(zipPath, DirectoryToBeArchive + ".zip", CompressionLevel.Fastest, false);

    Directory.Delete(DirectoryToBeArchive);
}
</code></pre>

<p>Help Would be Much Appreciated. Thanks in Advance. :)</p>