Tuesday, 12 May 2015

c# ZipFile.CreateFromDirectory - the process cannot access the file “path_to_the_zip_file_created.zip” because it is being used by another process



Solution:

//WRONG
ZipFile.CreateFromDirectory("C:\somefolder", "C:\somefolder\somefile.zip");
//RIGHT  
ZipFile.CreateFromDirectory("C:\somefolder", "C:\someotherfolder\somefile.zip");