Skip to main content
 首页 » 编程设计

c#之如何停止在 C# 中运行 exe 以启动新实例

2024年02月23日15TianFang

我有一个用 C# 编写的服务器软件。有时我会犯这个错误:

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

我如何理解我的程序仍在后台运行并停止它?

请您参考如下方法:

这很可能不是由您的软件(您正在编写的软件)引起的,而是由 IDE 本身引起的。

我通常只是使用任务管理器来杀死任何仍在挂起的 vshost 进程,但这可能不是很安全。或者有时只需要重新启动 Visual Studio。