[Solved] Unable to remove directory app.publish

Sometimes what you would think should work flawless, it turns out it doesn’t.


You are compiling in visual studio and you get this error:

Unable to remove directory "bin\Release\app.publish\"


Unable to remove directory "bin\Debug\app.publish\"

It doesn’t matter the project type; WPF, Winforms, ASP.NET, MVC, etc.


You probably have your solution files in a OneDrive folder with OneDrive client on.

It seems like OneDrive locks files for syncing or messes up with the files timestamps or attributes. Therefore Visual Studio is unable to remove the folder or files.


Just unload your OneDrive client, and wait a couple of seconds.

Your solution should now recompile again without problems.

You can turn OneDrive back on when you finish and let it resync.

Alternatively, you can go to OneDrive SettingsAccount/Choose folders, navigate to your project folder and unmark the “bin” folder. Also, you can just move your solution out of OneDrive.

1 comment
Posted by barez on 4/15/2018 8:04:24 AM
Thanks, it helped me. I changed nothing (use onedrive since years) but this problem appeared yesterday.
Leave a comment
Display Name:  



Domain Registrations starting at $9.69
Powered by Carlos Bercero Blog Platform © 2009