I had the same problem. In my case, it was a typo in command for .NET Core publish:
dotnet publish "Api.csproj" --output "....\output\"
OnlyIt created the directory with name '....', which I couldn't remove or rename. This directory acted like reference to parent directory. If I go inside that folder, I still was in parent folder, but path was appended by '....'.
I tried all of the commands mentioned in this topic, but none of them worked. In my understanding, it acted like that, because I had other files and directories in parent directory, so I had to use parameters that can recursively deletes all the content.
I found out, that this command helped:
rmdir /s /q ....\
can remove the '....' directory. It only deletes the reference to parent directory, which this '....' directory actually is, nothing more, nothing less. Despite the command arguments:
- /s - removes all the content inside removed directory,
- /q - removes without confirmation,
the parent directory remained untouched.