【问题标题】:Unable to copy file .exe in Visual Studio 2017无法在 Visual Studio 2017 中复制文件 .exe
【发布时间】:2018-01-04 21:17:59
【问题描述】:

我有一个引用 .NET Framework 的 asp.net 核心项目,我正在使用 Visual Studio 2017 Enterprise。当我尝试构建我的解决方案时,我遇到了这个错误:

Unable to copy file "obj\Debug\net461\MyProject.exe" to "bin\Debug\net461\MyProject.exe". 
Access to the path 'bin\Debug\net461\MyProject.exe' is denied.

即使我清理了解决方案并重新构建,我仍然有这个错误。

有人遇到过这个错误吗?

【问题讨论】:

  • 您可能正在运行该程序。你需要杀死它。

标签: c# asp.net visual-studio asp.net-core visual-studio-2017


【解决方案1】:

转到任务管理器并查找 Microsoftvshost.exe 并将它们全部杀死。即使您停止调试,exe 也可以继续在后台运行。这会导致文件锁定。

【讨论】:

  • 感谢您的帮助@Ottak。我还不得不关闭我的防病毒软件一段时间,它看起来像是在保存那个文件。
【解决方案2】:

关闭应用程序并删除 Obj 和 bin 文件夹

【讨论】:

    【解决方案3】:

    首先,确保您已停止 .net 核心 localhost 服务器,然后再尝试构建解决方案。

    【讨论】:

      【解决方案4】:

      我以前见过这个错误。尝试以下方法对我有用:

      1. Close the current solution.
      2. Close Visual Studio.
      3. Start Visual Studio in Administrator mode.
      4. Re-open and build the solution.
      

      以上可以避免常见的copy file和file Access Denied错误。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2018-10-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多