briba
briba

Reputation: 2987

Can't built my Console Application

From time to time I receive this error message when I'm debugging my Console Application:

The process cannot access the file 'bin\Release...' because it is being used by another process. Exceeded retry count of 10. Failed.

The fact is that it's not running and Visual Studio keeps showing this message, and so I have to restart it and build it again.

The process is NOT running, so there is no reason to receive this error.

Does anyone know why this is happening?

Upvotes: 1

Views: 1252

Answers (5)

Haja Maideen
Haja Maideen

Reputation: 468

What version of Visual Studio? You tagged it as VS 2013, correct?

Did you look at the following threads at Microsoft? Many complaining about similar issue.

https://connect.microsoft.com/VisualStudio/feedback/details/533411 http://connect.microsoft.com/VisualStudio/feedback/details/811846/visual-sudio-cant-complie http://connect.microsoft.com/VisualStudio/feedback/details/647826

Upvotes: 1

Dylan
Dylan

Reputation: 165

I had a similar issue in the last couple of days. The reason this happened to me is because I was testing a Windows Service I created. When I forgot to stop the service, and tried to build, I got this error.

Follow the suggestions in the other posts. As well, you may want to download Process Explorer from Microsoft - It might give you additional insight and allow you to kill any linger process.

Upvotes: 1

Moby Disk
Moby Disk

Reputation: 3861

  1. Verify that nothing has changed the file permissions, and the file isn't read-only. Verify that you cannot delete the file yourself. If so then yes, something is blocking it.
  2. Download handle.exe, which is a command-line tool that shows you what process is locking a file.
  3. If handle.exe says nothing is using your file, or it says devenv.exe is using it, then I think you have hit that intermittent bug in Visual Studio. Your only option is to restart Visual Studio. If you do a google search for "used by another process" with site:connect.microsoft.com you will find that this bug gets reported, then fixed, then reported, then fixed - over many years. Personally, I have had this happen most often on VS2010 using WPF projects. It has yet to happen to me on VS2013. So upgrading might help.

Here is my Google search.

Upvotes: 4

Neil
Neil

Reputation: 1066

I'm not sure why you are debugging the release build?

When this happens, it usually is due to being opened i.e. the console window that has ran the app is still open, or it is still in the process of closing.

However, again I feel it's due to debugging a release built application.

Upvotes: 1

Giu
Giu

Reputation: 1952

If the process is not running, I suppose Visual studio is the process that uses bin\Release.

If you want to know exactly what the problem is, delete everything in the folder (if possible), the file that will not be deleted will be the one that is used by Visual Studio, this will already be a good indicator.

Upvotes: 1

Related Questions