• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes


My project was running all fine which is built using winforms and c# in visual studio 2010, but all of sudden i started to get following message from nowhere:

Unable to copy file "obj\Debug\TestProject.exe" to "bin\Debug\TestProject.exe". The process cannot access the file "bin\Debug\TestProject.exe" because it is being used by another process.

by (720 points)  
edited by

2 Answers

0 votes

Possible Cause:

It is really Visual Studio itself that is keeping the document open, and a resulting task can't overwrite it. The error simply occurs, and after that won't leave until you restart Visual Studio, which will make the lock on the record go.

Some solutions provided for this is pre-build scripts that deletes the locked .exe file so that the debug hosting process could be killed or using Task Manager to kill it but this is all temporary solution.


The error initiated when changes to projects AssemblyInfo.cs was done

[assembly: AssemblyVersion("1.0.*")]

I did above to get automatic versioning  actual code was like this:

[assembly: AssemblyVersion("")]

Presently in the event that you replace the last two digits of the gathering form with a asterisk, at that point Visual Studio will replace it with new values each time you build. The values it uses are really founded on the present date and time. This appears to be valuable, since now you won't be left with adaptation and Visual Studio increases forms each time you build, so you don't need to do this physically.

by (4k points)  
0 votes

Another Solution:

The best way to tackle this issue is change the build from Release to Debug or Debug to Release,

then build and then go back to previous configuration and build again the problem will be sorted out.

by (4k points)