错误“无法复制文件,因为该文件正在被另一个进程使用 [英] error "unable to copy file because it is being used by another process

查看:340
本文介绍了错误“无法复制文件,因为该文件正在被另一个进程使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用使用C#语言的Windowsform应用程序,我有很多表单,当我想从一个表单遍历到另一个表单时,我使用 this.Hide();

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,

我知道解决方案是使用Windows任务管理器结束进程,但是问题是我有什么方法可以使用表单之间的行程而不会导致此错误?

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

推荐答案

尽管您Hide()您的表单,但它们仍作为流程的一部分保留.如果您未正确关闭所有表单,则该过程将继续运行,并且无法重新编译您的项目,最终您将不得不使用taskmanager终止该过程.
Visual Studio会尝试重写您的可执行文件,如果该可执行文件作为一个进程运行,则Windows将拒绝写入您的.exe.

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.

这篇关于错误“无法复制文件,因为该文件正在被另一个进程使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆