gpt4 book ai didi

c# - 无法将文件从 obj\Debug 复制到 bin\Debug

转载 作者:IT王子 更新时间:2023-10-29 03:52:58 25 4
gpt4 key购买 nike

我有一个 C# 项目,每次我尝试编译该项目时都会收到此错误:

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

所以我必须从任务管理器中关闭进程。我的项目只有一种形式,没有多线程。

解决方案是什么(不重启 VS 或终止进程)?

enter image description here

最佳答案

这应该有效。

转到您的项目属性。在 Build Events 中,在 Pre-build event command line 下,添加这两行代码:

if exist "$(TargetPath).locked" del "$(TargetPath).locked"
if exist "$(TargetPath)" if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"

关于c# - 无法将文件从 obj\Debug 复制到 bin\Debug,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2625239/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com