Bug 60377 - MSBuild is getting confused by similar provisioning profiles
Summary: MSBuild is getting confused by similar provisioning profiles
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: MSBuild ()
Version: XI 11.4 (d15-5)
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: 15.6
Assignee: Jeffrey Stedfast
URL:
Depends on:
Blocks:
 
Reported: 2017-10-25 19:59 UTC by Oleg Demchenko
Modified: 2017-12-18 14:10 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Oleg Demchenko 2017-10-25 19:59:47 UTC
Description:

I just discovered a very interesting problem with provisioning profiles detection in MSBuild. I have two profiles installed on my machine named the same and registered for the same bundle id.

One of these profiles is invalid/inactive because it references revoked a certificate. Another profile is valid and references a valid certificate.

Steps to reproduce:
1) Create new iOS project
2) Run automatic provisioning
3) Revoke certificate used by automatic provisioning on Apple Developer Portal
4) Remove old certificate from keychain
5) Run automatic provisioning once again
6) Build the project and run on device

What happens next - MSBuild picks the invalid/inactive profile (created in step #2) and it's not desired behavior. Deployment fails with:

No iOS signing identities match the specified provisioning profile 'VS: com.xamarin.12345 Development'.

Expected:

We should find a way to identify to find matching the valid profile and build/deploy the app successfully.

Workaround:

Delete invalid profile.

Env:

https://gist.github.com/olegoid/1f399fd5535ef431fa26187895b406e3
Comment 1 Oleg Demchenko 2017-10-25 20:10:32 UTC
Update: By saying "named the same" I meant that the names of profiles on Developer Portal are the same but ID is different.
Comment 2 David Karlaš 2017-11-08 03:17:17 UTC
Problem is explained well, confirming without trying myself...
Comment 3 Jeffrey Stedfast 2017-12-11 17:41:59 UTC
The logic already picks the most recent provisioning profile. Perhaps there is a bug in that logic?
Comment 4 Jeffrey Stedfast 2017-12-11 21:35:32 UTC
The profiles were being sorted in the wrong direction (oldest -> newest instead of newest -> oldest).

PR for Xamarin.MacDev: https://github.com/xamarin/Xamarin.MacDev/pull/18
Comment 5 Sebastien Pouliot 2017-12-18 14:10:05 UTC
https://github.com/xamarin/xamarin-macios/pull/3094
merged in master ddf9d63078516f152ac41d498d23aa357fc1333a