I have a weird problem in Visual Studio:
if an unhandled exception is thrown during the debugging process I'm not able to build my C# application:
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)"
Is there a permanent solution to solve this strange error? (my only workaround is currently to restart Visual Studio)
What I tried and not worked for me:
It's also not practical to insert Pre-build event scripts in all of my projects! Link: https://blog.ndepend.com/visual-studio-script-saves-time-pain/
Does anyone have a solution to this problem?
What worked for me - Close the Solution, Delete the bin and obj folder, re-open and build.