Lately I have been facing this error for one of my release definition and I am not able to figure it out why is this happening.
I tried manually deleting the folders inside the r1 directory but it fails to delete the 'a' folder i.e. artifact directory and says the folder or file in it is open in another program. But its shocking that the 'a' folder is empty and don't even have a hidden files and folders in it.
As a work around, to make the release successfully get deployed I have to restart my server each time whenever I want a new release to be deployed. Which is really very annoying.
Below is the complete error that I get on the Release definition summary.
Errors (2)
Downloading artifacts failed: Microsoft.VisualStudio.Services.Agent.Worker.Release.Artifacts.ArtifactDirectoryCreationFailedException: Failed to create Release artifact directory 'C:\Agents\DA_CID22\r1\a'. ---> System.IO.IOException: The process cannot access the file '\?\C:\Agents\DA_CID22\r1\a' because it is being used by another process. at System.IO.Win32FileSystem.RemoveDirectoryHelper(String fullPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound) at System.IO.Win32FileSystem.RemoveDirectory(String fullPath, Boolean recursive) at Microsoft.VisualStudio.Services.Agent.Util.IOUtil.DeleteDirectory(String path, Boolean contentsOnly, Boolean continueOnContentDeleteError, CancellationToken cancellationToken) at Microsoft.VisualStudio.Services.Agent.Worker.Release.ReleaseFileSystemManager.EnsureEmptyDirectory(String directoryPath, CancellationToken cancellationToken) --- End of inner exception stack trace --- at Microsoft.VisualStudio.Services.Agent.Worker.Release.ReleaseFileSystemManager.EnsureEmptyDirectory(String directoryPath, CancellationToken cancellationToken) at Microsoft.VisualStudio.Services.Agent.Worker.Release.RetryExecutor.Execute(Action action) at Microsoft.VisualStudio.Services.Agent.Worker.Release.ReleaseJobExtension.CreateArtifactsFolder(IExecutionContext executionContext, String artifactsWorkingFolder) at Microsoft.VisualStudio.Services.Agent.Worker.Release.ReleaseJobExtension.d__34.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Services.Agent.Worker.Release.ReleaseJobExtension.d__31.MoveNext()
Failed to create Release artifact directory 'C:\Agents\DA_CID22\r1\a'.
Any help or advice would be really helpful.