Possible Duplicate:
xCode 4 -reinstalls keychain certs that I delete
The question says it all in a nutshell.
When building a project in Xcode, I receive the error message from the Check dependencies step:
CodeSign error: Certificate identity 'iPhone Developer: xxxxx' appears more than once in the keychain. The codesign tool requires there only be one.
Problem is, this certificate identity is reinstalled whenever Xcode is launched. It is an expired certificate too, that causes extra confusion. So I delete it in keychain, and build the project and everything works.
Quit Xcode, restart, watching Keychain, and TA-DA! the expired certificate reappears.
I feel like I'm back on a virus-infected windows machine.
Since the project builds and executes properly when the cert is deleted, the only problem is the automatic installation xcode does.
Edit:
I think it's got to be related to an examination that xcode does of the keychain, for whatever reason. Then xcode decides to install the cert based on its checkup of keychain, though it's a faulty decision. I could probably solve this problem if I spent 24-48 hours, but I'm able to keep working, without quitting Xcode. :)
I had the same experience with XCode 3 (not 4) and removing the old certificate in Keychain only wouldn't work.
I also add to remove all of my old provisioning profiles using the old certificate with Organizer then quit XCode, remove the old certificate from Keychain and restart XCode.
Now it seems to work fine!