I have MSB4018 error and I try any the above solutions but could not solve
Finally, I found that saving the current project in the Drive folder caused some files to be locked by Drive for syncing, and generated error MSB4018
I moved the project out of the Drive folder, the error was resolved immediately