I\'m trying to build an extension project and Xcode keeps throwing the error in subject.

It looks like the bundle ID behavior changed when WatchOS 2 arrived.
Previously I had an extension bundle identifier like this:
com.mycompany.myappname.watchkitextension
Somewhere else on Stackoverflow it was mentioned that the extension bundle identifier should be in this format, but no matter what I tried Xcode kept throwing errors at me.
The only possible solution is changing the extension bundle identifier to:
com.mycompany.myappname.watchkitapp.watchkitextension
I am pretty sure this wasn't the case with an WatchOS 1 app. A problem because of this change is that you can't actually generate an app id for the bundle identifier com.mycompany.myappname.watchkitextension. This isn't necessary, just set all provisioning profiles in the build settings to automatic and don't forget to use the right code signing certificate for you release/ad-hoc/debug schemes.
I actually found out that this approach works because Xcode suggested fixing the problem and this is what it did.