Forum Visual Studio

How do I get Visual Studio to refresh Provisioning Profiles

EasyGoingPatEasyGoingPat GBMember ✭✭✭

This is a close match to this post: https://forums.xamarin.com/discussion/145885/no-matching-provisioning-profiles-found-cant-deploy-ios-app-to-phone but I am posting this as a new question to attract attention because I desperately need to solve this issue.

In Visual Studio no valid Provisioning Profiles appear in even though there are valid profiles displayed in XCode.

If I take the advice in the post above and create a blank project in XCode on the Mac build host, it says it cannot target my physical phone because I am trying to target iOS 13.4 but my iPhone 6 is on iOS 12.4. This may well be the problem I am seeing in Visual Studio.

I have changed the target to 12.4 in Info.plist | Deployment Target. Is this the only place I need to change it and how do I get the list of Provisioning Profiles to refresh in Visual Studio?

Any help would be (desperately) appreciated as this is obviously a complete show-stopper.

  • Patrick

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai

    I have changed the target to 12.4 in Info.plist | Deployment Target

    Xamarin iOS always used the current version to build and deploy the project. What you changed in the info.plist is the minimum version it supports. Open the info.plist with XML Editor you will see its real meaning there.

    there are valid profiles displayed in XCode.

    XCode will list all the provisioning profiles installed including the ineligible ones. If there's no provisioning profile matches your project's bundle ID, VS won't display any files there.
    Try to create a new project with the same bundle id as the XCode project. Will a valid provisioning profile occur? Additionally, VS should be paired to Mac before selecting this setting.
    Moreover, the provisioning profiles are stored on the Mac. If you want to clean up them, try this thread:
    https://stackoverflow.com/a/39289447/8354952

  • EasyGoingPatEasyGoingPat GBMember ✭✭✭

    @LandLu

    Thanks for the explanation.

    I've just recreated my profiles from scratch on Apple's website and reinstalled then on the physical phone but still they don't appear in Visual Studio. I've obviously got something wrong but I've been absolutely meticulous. I don't know how to debug this. The profiles simply not appearing in VS is not helpful on its own. Could I look for anything in log files that might indicate why an apparently valid profile is being excluded?

    Incidentally, automatic provisioning worked a treat, which is a huge improvement over last time I used it some months ago, so well done for that! It gets me going but I do need to sort the manual process.

    • Patrick
  • LandLuLandLu Member, Xamarin Team Xamurai

    Do you install the corresponding certificate on the Mac the provisioning profile includes?
    Make sure the private key of the certificate has been correctly installed.

  • EasyGoingPatEasyGoingPat GBMember ✭✭✭

    @LandLu

    I believe so. I deleted absolutely everything in my Apple Developer account and used the SO link you gave above to clean up the Provisioning Profiles on the Mac. Then I recreated everything. Everything seems to go okay but I still cannot select the profile in Visual Studio.

    Interestingly, in VS, if I select Manage Accounts | Details, it shows the following:

    Apple Development: MY_NAME (MACHINE_NAME) Valid
    Apple Development: MY_NAME Not in Keychain

    The top one, which includes my Window machine name, is the one created by the automatic provisioning. The other one is the one I manually created on Apple's website and then double clicked on the Mac to install it in the keychain. I don't know why this would be invalid. I get no error when I install it.

    The list of Provisioning Profiles does show all the ones that I have manually installed and also the VS WildCard one.

    I honestly don't know what else to try. All I can do is delete everything again and recreate it all again but I'm fairly certain I'll get the same result.

    When VS filters my profiles from the list, I'd love to know what it is looking for that fails.

    I realise there is probably not much more help you can offer without being at my machine, but thank you anyway.

    • Patrick
  • LandLuLandLu Member, Xamarin Team Xamurai

    When we create a certificate on the Apple portal we need to provide a csr file.
    Was this csr file generated from your current Mac.
    Please check your keychain the valid certificate must contain a private key:

    Apple Development: MY_NAME Not in Keychain

    This will occur when you used another Mac's CSR to generate a certificate.

  • EasyGoingPatEasyGoingPat GBMember ✭✭✭

    @LandLu

    I've just deleted everything and emptied the profiles store on the Mac and the login keychain. Then I went through the whole process from scratch.

    I get an Apple Development Certificate containing my private key on in keychain on the Mac but VS still reports the certificate as no being in the keychain. The two images below show this.


  • LandLuLandLu Member, Xamarin Team Xamurai

    If you revoke the certificate on the Apple portal will it be notified by the VS?
    My suggestion is to remove all the valid certificates and provisioning files first and then check the VS part to see whether all the caches have been cleaned.
    Try to start creating new files after you get consistent results on both VS and Mac.

  • EasyGoingPatEasyGoingPat GBMember ✭✭✭

    @LandLu

    Thank you for your help but I'm going to have to leave this for now. I just can't get anywhere with it.

    One strange thing is that when I do clear everything and recreate one of everything, finishing with double-clicking the Provisioning Profile, it creates multiple keys of the form: 'Apple Development: MY NAME, which all say they are issued by 'Apple Worldwide Developer Relations Certification Authority'. Is this right or am I missing another issuing authority? I did delete a few when I was trying to get this working a couple of weeks back (seems longer).

    Another thing is that I tried disabling/enabling my iPhone and now two devices have appeared with the same UDID, so I can't enable either. This has now broken the auto-provisioning and there seems to be no way to fix this from the website (way to go, Apple!) so I am hoping their Developer Support get back to me with a fix.

    Life's too short for this!

    • Patrick
  • LandLuLandLu Member, Xamarin Team Xamurai

    Try not to use VS to create the certificate.
    Have you tried to create it directly on Apple portal?
    This article demonstrates how to create a distribution certificate. You could follow it to create a development certificate.

  • EasyGoingPatEasyGoingPat GBMember ✭✭✭
    edited April 29

    @LandLu

    I have been doing this on the Apple Portal from the start. I have followed guides on how to do this to the letter. No matter what I do, Visual Studio insists that my development certificate is not in the keychain, even though on the Mac the KeyChain program does show it as being present. It seems that Visual Studio is looking for some condition to be true that for some reason I cannot identify must be false and is therefore filtering the entry.

    It's strange, I went through all of this in VS2017, when the process wasn't as slick, but it seemed to work fine. This implies I do know how to do it - though obviously I am missing something.

    One oddity is that the drop-down in VS for Signing Identity now contains loads of entries and there seems to be no way to clear these to start fresh. When I clear everything from KeyChain on the Mac, it has no effect on this list, so maybe I do have a caching issue.

    I know you haven't got endless time to spend on this but would you be able to tell anything if I were to upload log files? Or could you tell me what I should be looking for in the logs?

    I think I may have reached the point where I am considering a complete reinstall of everything - VS, XCode, maybe the whole of OSX - because something must be broken somewhere.

    Thanks for the help so far.

    • Patrick

    PS - If I clear everything out on the Mac, delete my Apple ID in VS | Options | Xamarin | Apple Accounts, recreate it (which gives a message saying it is syncing), I immediately get 6 seemingly identical entries in the Signing Identity drop-down. Is this right?

  • LandLuLandLu Member, Xamarin Team Xamurai

    I noticed that you were using VS 2017 to build a Xamarin iOS project.
    Firstly, I highly suggest using VS 2019 as the latest Xamarin iOS requires:
    https://docs.microsoft.com/en-us/xamarin/ios/release-notes/13/13.16#requirements
    If you want one-to-one support, try to open a free support ticket here:
    https://support.microsoft.com/en-us/supportforbusiness/productselection?sapId=211dd84f-3474-c3c5-79bf-66db630c92a6

  • EasyGoingPatEasyGoingPat GBMember ✭✭✭

    @LandLu

    Sorry, I wasn't clear in my last comment. I am now using VS2019.

    I will try the support ticket link. Thank you.

  • LandLuLandLu Member, Xamarin Team Xamurai

    We could find the logs of VS through:

    Upload it here:
    https://support.microsoft.com/en-us/supportforbusiness/productselection?sapId=211dd84f-3474-c3c5-79bf-66db630c92a6
    to help us know more about your environment.

  • EasyGoingPatEasyGoingPat GBMember ✭✭✭

    @LandLu

    Hi! That link took me through the option of creating a new ticket, which I did. I think maybe I could have used my existing ticket and attached the log file to that. Sorry for the inconvenience.

  • LandLuLandLu Member, Xamarin Team Xamurai

    OK. Go ahead.

Sign In or Register to comment.