Visual Studio 17, 19, 22, Windows 10 or 11 pro: Error Unable to remove directory “bin\Debug\app.publish\”


Windows 10 or 11 pro, Visual Studio 2022 and previous versions:(c#)
I have been using VS sporadically over the years, and now and then I get the error:
“Error Unable to remove directory “bin\Debug\app.publish”. Access to the path ‘bin\Debug\app.publish’ is denied”.
The program is ok, except that it can not be run.

After searching and reading many suggestions, most of which refer to older VS versions, the only remedy I found that worked for me for all projects was to move the whole VS program from drive C: to drive D: (or any other than C).
This is not the best solution, as it is out of the default setup, and very inconvenient.
Is there another proven solution to this problem on drive C:?
Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *