1. Stop the Running Application
-
Make sure your app (
yourapp(ur application name)) is not running. -
Open Task Manager (Ctrl+Shift+Esc) → go to Details tab.
-
Find yourapp(ur application name)) → End Task.
-
Rebuild your project.
2. Clean and Rebuild
-
In Visual Studio:
-
Go to Build → Clean Solution
-
Then Build → Rebuild Solution
-
-
This clears the
objandbinfolders and rebuilds everything fresh.
3. Check for Debugger/Antivirus Locks
Sometimes, even if the EXE isn’t running:
-
Antivirus software may be scanning or locking the file — temporarily disable real-time protection or add your project folder to exceptions.
-
Visual Studio Debugger might not have released the file — close the solution and reopen it.
4. Manually Delete Locked Files
If the above doesn’t work:
-
Close Visual Studio.
-
Open File Explorer → navigate to your project folder.
-
Delete the folders:
-
Reopen Visual Studio → Rebuild.
If Windows says “file is in use,” use a tool like Process Explorer:
-
Download from Microsoft Sysinternals.
-
Search for (
yourapp(ur application name)) → right-click → Kill Process.
5. Disable Parallel Builds (Optional)
If your solution has multiple projects:
-
Go to Tools → Options → Projects and Solutions → Build and Run
-
Set “maximum number of parallel project builds” = 1
This avoids concurrent file access issues.
6. Check Post-Build Events
If you have a post-build script that copies or runs the EXE, ensure it’s not launching the app before the next build.