No iOS code signing key matches provisioning profile
Recently my team have come up against this error a few times building a Xamarin app using Visual Studio 2017 both on the Mac and PC, and it took a bit to work out the fix.
No iOS code signing key matches specified provisioning profile ‘xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx’
The simplest thing to try is open the properties window (or Options on Mac) of the iOS project, select the ‘iOS Bundle Signing’ tab and change the Signing Identity and Provisioning Profile back to Automatic. Save the project and close and reopen Visual Studio, now set the Signing Identity and Provisioning Profile back to the desired values and rebuild.
However, if like us this doesn’t fix the problem, open the
ProjectName.iOS.csproj file for editing (either in your favourite text editor or by unloading the project first in Visual Studio) and look for the
<CodesignProvision> tag. In our case(s) we found there were two entries, which must have been what was confusing Visual Studio.
To fix this, delete one of the entires (and for good measure we cleared the value out of the other entry), now reload the project, open the iOS Bundle Signing options and set the Signing Identity and Provisioning Profile to your desired values. You should now be able to build successfully.