Web deployment task failed

I got this error after I changed my Azure Web Application from DotNet 5 to DotNet 6. Web deployment task failed. (Unable to perform the operation ("Delete File") for the specified directory ("aaaa"). This can occur if the server administrator has not authorized this operation for the user credentials you are using. [In this case aaaa replaces the actual folder name]
In this case, the error was a bit of a Red Herring. It was not a permissions issue
To fix this, in my [File Publish Options] in the Publish [Show All Settings] I unticked [Remove additional files at destination]. This is because my website was still using DotNet 5 when I tried to remove it. After the Website Restart, my website was using DotNet 6, so I reticked [Remove additional files at destination] and Published and Published again, so additional files are removed next time. Problem Solved.