An alternate solution rather than closing all apps that might be locking the directory as just about every other answer says to do, would be to use a utility that will unlock the files/directory without closing everything. (I hate needing to restart Visual Studio)
LockHunter is the one that I use: https://lockhunter.com/ There are likely others out there as well, but this one has worked great for me.