Late to the party. Nonetheless, an even simpler solution was to "Clean" the project from Product-->Clean Build Folder. After that I checked my Certificate as described in the previous posts. All was fine with it, as I believe, so why an issue at build time?
That final step was to run "Build". That's it.
Coming from a IntelliJ IDEA, Vi, VSCode, awk, sed, Shellscript and Linux World and Java as my main language, I don't get the hassle Apple creates with its Signing stuff. Why would someone at an early stage of development need that? I do that at the end before shipping by random, here its mandatory. Just why?
The problem I want to mark is, that, when I close my working cheap project with some Metal, 3D stuff and change nothing, then re-open it a week later and just fire it up, why does this strange Xcode thing keeps me bugging me with "Command CodeSign failed with a nonzero exit code"?