TFS 2015 vNext build directory is not empty error

205 views Asked by At

I've recently started to encounter a problem with a new build agent that I have added to my TFS agent pool. The agent runs my build the first time without any problem. However, all subsequent builds fail with this error "##[error]The directory is not empty". This occurs on the initial startup of the build when it is trying to download files from TFS.

Keep in mind that I have set the "clean" option to true for the build and also set the Build.Clean variable to "all"

I've done searches online for this error and most of the info I am finding states that the directory is in-use and that is why it cannot be deleted. The strange thing is that I can manually delete the folder using Windows Explorer and there is no error reported of files in-use. Once I do that, the build will work again, but only on the first run. Why is it that the TFS vNext build cannot delete this folder? Is there a log that I reference that provides more details other than "directory is not empty"?

1

There are 1 answers

5
PatrickLu-MSFT On

You could set system.debug=true to enable verbose Debug Mode for TFS vNext Build.

In addition, you could also check the agent log under agent path\_diag path here.

enter image description here

If there are more information for troubleshooting.

Back to your issue, please try to stop you build agent service and restart again. Also update your build agent to latest version. Besides, you could also choose another driver such as D:\ or E:\ if you are using c:\agent\ which may do the trick.