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
Process cannot access file because it is being used by another process error message. To resolve this error: Press Ctrl + Alt + Delete, then click Task Manager. Ensure you're on the Processes tab.
Copy it threw an exception "File is being used by another process" again. But by simply copying this file in windows (ctrl+c) and pasting (ctrl+v) it worked.
Although you Hide()
your forms, they still remain as a part of the process. If you don't close every form properly, the process will remain running and you cannot recompile your project and eventually you will have to kill your process using the taskmanager.
Visual Studio tries to rewrite your executable and if the executable runs as a process, Windows will refuse to write to your .exe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With