Error deleting folder 'bin'. The system call level is not correct

This is an issue that Microsoft isn't going to fix, according to this post: http://connect.microsoft.com/VisualStudio/feedback/details/508695/cannot-delete-the-bin-folder-from-solution-explorer

They were going to make the error message more intuitive but I guess that didn't happen.

Update:

Microsoft has since deleted this page. Here is a cached copy: https://web.archive.org/web/20130825001252/http://connect.microsoft.com/VisualStudio/feedback/details/508695/cannot-delete-the-bin-folder-from-solution-explorer

The message from microsoft is as follows:

Posted by Microsoft on 11/20/2009 at 11:54 AM Thank you for your feedback. This is because we cannot delete the folder with the hosting process in it. However, the error message can definitely be smarter. We will not be able to address this in the VS2010 timeframe but I am resolving this as a postpone so that we can consider improving the error message post-VS2010. Thank you for contacting us.

Richa Prasad Program Manager Visual Studio Platform Team Posted by Microsoft on 11/11/2009 at 9:28 PM Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Thank you


This question is a bit ancient, but as of Visual Studio 2017 RC the error still exists. However, I would suggest that anyone that encounters this issue check to see if the folder / resource they are attempting to get rid of is not in use by another process. I ran into this issue deleting a font and forgot I had it open in the font viewer. Simply closing all processes where this font was in use worked like a charm!


Definitely, you are trying to delete a folder that is open in another Explorer window or is somehow being held in use by some other process. Closing that Explorer window or process should do the trick.

Unfortunately finding that process can sometimes be difficult (the process holding your file/folder hostage can be hidden or its window might be out of view). In that case, it might be necessary to log off or restart the PC to force a release. Admittedly, that seems like overkill.

Instead, I'd suggest you try the trustworthy Microsoft Windows Sysinternals tool called Process Explorer (https://technet.microsoft.com/en-us/sysinternals/processexplorer.aspx). Once you download it and run it (it has no setup procedure) and once it's up on your screen, click the binoculars in the toolbar and search for the file or folder in question ('bin' in your case.) What's neat about this tool is it will immediately focus on the process you click on in the search results list (you must choose which one you think is most likely the culprit). Then, in the main window which just centered in on that process, just hit the red X in the toolbar. That will kill it. In my case, it was the prevhost.exe process at fault. Killing it released the hold on that file I needed to delete/copy over, and it immediately allowed me to move on!

I would add to this conversation (for the sake of searchability) that the reported error in Visual Studio--"Error deleting the file 'filename.ext'. The system call level is not correct."--can also be accompanied by a complementary error in Windows Explorer when trying to delete the same file ("The action can't be completed because the file is open in another program. Close the file and try again.") Or when trying to copy or move another file over to replace that same file, you might get, "An unexpected error is keeping you from copying the file. If you continue to receive this error, you can use the error code to search for help with this problem. Error 0x800704C8: The requested operation cannot be performed on a file with a user-mapped section open."

All these errors are due to a file lock that can be released by killing the process at fault using the Sysinternals Process Explorer as I explained.