I would like to delete the local repo folder that I cloned from remote repository using LibGit2Sharp. I read here here that I have to Dispose() the Repository before I can delete it, but it still not works fine.
using (var repo = new LibGit2Sharp.Repository(path))
{
repo.Dispose();
}
Directory.DeleteFolder(path);
And I still have an exception:
Access to the path 'c16566a7-202a-4c8a-84de-3e3caadd5af9' is denied.
The content of the 'path' variable is the following:
C:\Users\USERNAME\AppData\Local\dftmp\Resources\c16566a7-202a-4c8a-84de-3e3caadd5af9\directory\UserRepos\github.com\domonkosgabor\testrepo
This folder was created by a worker role to a local storage.
What should I do to delete the whole folder (including .git)?
path
folder has a Guid, not a folder path. Where is it coming from? Also,I read here that I have to Dispose()
Where is here? Did you forget a link? – Fagenif (Directory.Exists(path))
before theDeleteFolder
code to make sure the directory is actually there. – Fagen