gpt4 book ai didi

c# - 文件被 Visual Studio 2019 锁定

转载 作者:行者123 更新时间:2023-12-02 09:22:07 26 4
gpt4 key购买 nike

我在 Visual Studio 中遇到一个奇怪的问题:

如果在调试过程中抛出未处理的异常,我将无法构建我的C# 应用程序:

Unable to copy file "C:\Projects\A\bin\A.dll" to "..\..\bin\A.dll". 
The process cannot access the file '..\..\bin\A.dll' because it is being used
by another process.

Could not copy "C:\Projects\A\bin\A.dll" to "..\..\bin\A.dll".
Exceeded retry count of 10. Failed.
The file is locked by: "Microsoft Visual Studio 2019 (14904)"

有没有永久的解决方案来解决这个奇怪的错误? (目前我唯一的解决方法是重新启动 Visual Studio)

我尝试过但不适合我的方法:

  • VS 菜单 -> 工具 -> 选项 -> 项目和解决方案 -> 生成并运行 -> 并将“设置最大并行生成数”设置为 1。
  • 停止防病毒软件
  • 启用应用程序体验服务(Windows 10 中未提供)
  • 取消勾选 VS 菜单 -> 工具 -> 选项 -> 项目和解决方案 -> 常规 -> 允许并行项目初始化
  • 取消勾选“调试”->“选项”->“调试”->“常规”->“当一个进程中断时中断所有进程”

在我的所有项目中插入预构建事件脚本也是不切实际的!链接:https://blog.ndepend.com/visual-studio-script-saves-time-pain/

有人能解决这个问题吗?

最佳答案

对我有用的方法 - 关闭解决方案,删除 bin 和 obj 文件夹,重新打开并构建。

关于c# - 文件被 Visual Studio 2019 锁定,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56866981/

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