I am using the SharpSvn library in an application. As part of my automated integration tests, I create a test repository, check out a working copy, perform some tests, and then delete both the repository and working copy folders.
However, a simple Directory.Delete(workingCopyPath, true);
always yields an UnauthorizedAccessException
with the message "Access to the path 'entries' is denied.". I can reproduce the error with this code:
using (var svnClient = new SvnClient())
{
svnClient.CheckOut(
new SvnUriTarget(new Uri(repositoryPath)), workingCopyPath);
}
Directory.Delete(workingCopyPath, true);
This error still occurs if I
- try to delete a working copy created by a previous run of the integration tests
Thread.Sleep
a few seconds before trying to delete
If I use explorer to manually delete the temporary working copy, I don't get any error.
What is going wrong here? What is the proper way to programatically delete a subversion working copy?