I use windowsform application using C# language, I have many forms, and when I want to traverse from one to another, I use this.Hide();
When I use this method, I receive the shown error,
I know that the solution is to end process using windows task manager, But the question is that Is there any way I can use travel between forms without leading to this error?
Error 9 Unable to copy file "obj\x86\Debug\WindowsFormsApplication1.exe" to "bin\Debug\WindowsFormsApplication1.exe". The process cannot access the file 'bin\Debug\WindowsFormsApplication1.exe' because it is being used by another process. C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets 2868
I believe this is happen while you compiling the application or you start debugging the application.
This may be due to.
Simple method is to delete the .exe file from the project directory folder and build the project again. this will create new exe file and problem will solve.
Just delete the
.exe
file in thebin
folder:bin\Debug\WindowsFormsApplication1.exe
Don't worry, the build will create a new one.
I finally how fix it. Why we can't continue debug after the first debug because the first debug exe still running. So that, after first debug, you need to go to Task Manager -> Process Tab -> [your project name exe] end the exe process.
Easy going solution is to add some code in Project Properties..
Just go to Project tab and select project properties.. From there select Build event tab. And in Pre-build event Command line add the following code..
I managed to fix it by deleting the suo file (hidden solution file).