How to stop Windows Task Manager from interfering with VS build

Hong 1,141 Reputation points
2024-05-10T15:55:53.4466667+00:00

I often get the following error after an app under debugging crashes:

DEP1000: Cannot copy file "E...\MY_APP\bin\x64\Debug\MY_APP.exe" to layout "E...\MY_APP.UWP\bin\x64\Debug\AppX\entrypoint\MY_APP.exe". IOException - The process cannot access the file 'E...\MY_APP.UWP\bin\x64\Debug\AppX\entrypoint\MY_APP.exe' because it is being used by another process. [0x80070020]

The remedy is closing Windows 11's Task Manager. Is there a way to prevent the Task Manager from interfering with the build process?

Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
951 questions
0 comments No comments
{count} votes

Accepted answer
  1. Anna Xiu-MSFT 26,646 Reputation points Microsoft Vendor
    2024-05-13T08:00:15.8133333+00:00

    Hi @Hong, 

    Welcome to Microsoft Q&A! 

    You can enable Task Manager Efficiency mode to reduce process interference. 

    Furthermore, you can use the Process Explorer or File Locksmith tools to check what process is locking the file. 

    Besides, for the issue, you can close all running VS instances and manually delete the bin and obj folders in your project folder. Then, re-launch the VS. 

    If you have any anti-virus software, please temporarily disable it. 

    Sincerely,

    Anna


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".  Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful