Exquirentibus
Exquirentibus

Reputation: 45

VS 2022 Cannot get rid of VS:WildCard Development provisioning profile for Maui Apple deployment

After I added correctly entered my Individual Apple Developer account to Xamarin/Apple Accounts, I went to Auto Provision.

There were two choices for the team

One had the 'NAME' I entered for the Apple key from Apple's 'Users and Access' Keys tab followed by KEY ID.

The Other had 'My Name' followed by the KEY ID.

I selected the one with 'My Name' and thought I could see what that was, but it immediately created a profile from this.

I think I Should have selected he one with the 'NAME' I gave the key?

When I tried to deploy to my iPhone connected to my Mac I got an error of:

>Detected signing identity:
1>  Code Signing Key: "Apple Development: Created via API (KEY ID)" (numbers from unknown)
1>  Provisioning Profile: "VS: WildCard Development" (hex digits from unknown)
1>  Bundle Id: com.companyname.mauixxx
1>  App Id: XXXX.com.companyname.mauixxx
..
1>Warning: unable to build chain to self-signed root for signer "Apple Development: Created via API (KEY ID)"
1>/Users/me/Library/Caches/Xamarin/mtbs/builds/Mauixx/hex digits/bin/Debug/net7.0-ios/ios-arm64/device-builds/iphone8.4-15.7.5/Mauixx.app: errSecInternalComponent
1>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.2.2035\tools\msbuild\iOS\Xamarin.Shared.targets(2150,3): error : /usr/bin/codesign exited with code 1:
1>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.2.2035\tools\msbuild\iOS\Xamarin.Shared.targets(2150,3): error : Warning: unable to build chain to self-signed root for signer "Apple Development: Created via API (KEY ID)"
..
Warning: unable to build chain to self-signed root for signer "Apple Development: Created via API (KEY ID)"

After shutting down VS 2022, I tried deleting my Apple Account in VS 2022 and the obj & bin folders and AppData\Local\Xamarin\iOS\Provisioning folder.

However, when I add back in my apple account and select my name in the 'Team Name' and click 'View Details' it now shows THREE Certificates (none in keychain) Two seem identical "Apple Distribution: My Name" of type 'Apple Distribution'

And one 'Apple Development Created in API' of type Apple Development.

And the ghosted 'Provisioning Profile' of 'VS:WildCard Development' is back, even though I did Not yet try to Auto Provision?

I can't even Manually provision as if I choose the Signing Identity of 'Distribution (Automatic) [the other choices were 'Apple Development: Create via API (KEY ID) and 'Developer Automatic).

And then when I look in the provisioning profile .. Only that VS:WildCard profile shows up that I can't get rid of?

If I Now try to Auto provision, using the Wrong Team with my name, I get an error that the Certificate: Apple Development Created via API (KEY ID) already exists but can't be found in the local Keychain?

Just a Total Mess??

  1. How can I start from scratch and get rid of this VS:WildCard Development profile in VS2022??

  2. Will auto provisioning work if I select the 'team' that has the NAME of the Apple Key instead of the one with my name?

Upvotes: 0

Views: 1225

Answers (2)

Liyun Zhang - MSFT
Liyun Zhang - MSFT

Reputation: 14479

Apple Development: Create via API (KEY ID) means it's created by your entered for the Apple key from Apple's 'Users and Access' Keys tab.

when I add back in my apple account and select my name in the 'Team Name' and click 'View Details' it now shows THREE Certificates (none in keychain) Two seem identical "Apple Distribution: My Name" of type 'Apple Distribution'

This mean that you have the cetificate and distribution profile on the apple developer website, but it doesn't exist on your machine or they are mismatched.

And you said

unable to build chain to self-signed root for signer "Apple Development: Created via API (KEY ID)"

This is because you missed the WWWDC root certificate which may be about the THREE Certificates (none in keychain). I don't known you how to create the certificate, you can check if it exist on your mac keychain or not.

And about

How can I start from scratch and get rid of this VS:WildCard Development profile in VS2022??

You can try to choose VS:WildCard Development profile after choosing the Signing Identity in the Manually provision mode. If you can't choose VS:WildCard Development profile, please show the error message or the screen shot.

And for

Will auto provisioning work if I select the 'team' that has the NAME of the Apple Key instead of the one with my name?

I suggest you choose the one has key id(Apple Development: Create via API (KEY ID)), because the way without key id is not supported now.

Update1:

The key of your problem is you want to use the distribution you need. So first of all, you can login apple developer account and check the distribution you need is valid or not.

If the distribution is valid, you can export the p12 file from the mac and import it into the VS. And if it is invalid, you need to create a distribution profile.

Update2:

'unable to build chain to self-signed root for signer "Apple Distribution: My Name (XXXX)'

It means the AppleWWDRC is missing, this might be related to the updates of MacOS updates. 

For self-signed root error, it usually means that the AppleWWDRCA is out of date or missing. You could open Keychain on your Mac, go to Login->Certificates, then check if there is a certificate named "Apple Worldwide Developer Relations Certificate Authority" or if it is missing. And you can open Apple PKI - Apple, and download Worldwide Developer Relations - G3 (Expiring 02/20/2030 00:00:00 UTC) and install into your Mac or other certificate you prefer to, then double-click the cer to install into your Mac. After that, you can pair to Mac.

In addition, Xcode 14.3 with iOS16.4 is not supported for now. It's recommended that waiting for the official VS updates.

You can refer to [META] Xcode 14.3 Support for Xamarin, .NET 6/7 and MAUI · Issue #17561 · xamarin/xamarin-macios · GitHub.

Update3: If you can select the distribution provisioning profile in Archive Manager when you publishing and you can test the app via TestFlight, it means the distribution certificate and profile are correct.  Development certificate and development provisioning profile are for debug mode, distribution certificate and  provisioning profile are for release mode and publishing. You have to create the distribution provisioning profile manually when publishing, refer to Publish a .NET MAUI iOS app for App Store distribution - .NET MAUI | Microsoft Learn

In addition, you don't have to configure the devices for distribution provisioning profile. If you want to test the app on other devices, you can invite the user with AppleID in AppStore Connect.

Update4:

also seems to require each iPhone to be connected by USB at some point?

Please make sure your Windows machine has been paired to your Mac. You can use the Debug Target drop-down to select iOS Remote Devices and then Remote Device  with Visual Studio.  Refer to the following doc: Publish a .NET MAUI iOS app for App Store distribution - .NET MAUI | Microsoft Learn (How to select provisioning profile is at Step 5-9 of Publish the app section)

 

Testflight is an Apple official testing tool. When you upload the app(.ipa file) to App Store Connect, you can manage your app and test the app by this way. And you can see the Apple's doc: Overview of TestFlight - Test a beta version - App Store Connect - Help - Apple Developer( In the left tool bar, it shows how to add testers)

If you cannot publish the app via 'Archive Manager', please feel free to post the error messages here, and we can investigate further. (And  you can switch to XCode  for publishing)

Update5:

Archive Manager is a tool in VS and you can see the previous archives when you right-click the MAUI project folder and click "View Archives". I mean the distribution provisioning profile is correct if you can select the provisioning profile in Archive manager during the publishing progress. Please see the  Step 5-9(Publish a .NET MAUI iOS app for App Store distribution - .NET MAUI | Microsoft Learn )

I watched the video, you can configure TestFlight tests according to what the video said. Please refer to Xamarin's Doc- Using TestFlight to Distribute Xamarin.iOS Apps - Xamarin | Microsoft Learn , it applies to MAUI as well. 

In addition, TestFlight is an Apple's tool, it's recommended  that you try AppCenter if you want to use a Microsoft tool . (MAUI builds in AppCenter is in progress and not supported for now, see .net maui build · Issue #2534 · microsoft/appcenter · GitHub)

Upvotes: 1

Exquirentibus
Exquirentibus

Reputation: 45

The process of deploying a Maui app to my local iPhone using VS 2022 17.5.4 on Win10 and then hopefully to TestFlight for beta testing has been a .. Disaster. I'm attempting to Deploy to an iPhone SE 2020 (developer mode on) with 16.4.1.

I set the cert up for for distribution (not development) and the app store but use no Entitlements.

I'd originally tried the Automatic provisioning and I couldn't even get it to .. Build.

I'd get a build error of:

Warning: unable to build chain to self-signed root for signer "Apple Development: Created via API (XXXXXX)" no matter what.

To finally get rid of the "VS: WildCard Development' profile (should always have been Distribution, not Development), I ended up revoking permissions on all certs, deleting the provisioning profiles, and most importantly Deleting the AppData\Local\Xamarin\iOS\Provisioning folder.

Without deleting the AppData\Local\Xamarin\iOS\Provisioning folder certs and provisioning profiles would come back from the dead.

I never got Automatic Provisioning to work.

I finally did a Manual provisioning, and I believe I also double clicked on the distribution.cer file on Ventura

After a successful build I then attempt to deploy to my tethered iPhone.

I can actually see the Maui app icon start to appear on my iPhone but the deploy fails with:

ApplicationVerificationFailed: Failed to verify code signature of /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.XXXX/extracted/MauiApp.app : 0xe8008015 (A valid provisioning profile for this executable was not found.)

error MT1006: Could not install the application '/Users/myName/Library/Caches/Xamarin/mtbs/builds/MauiApp/356f14c579837311873d77f647dab69721fb81ab8dca73cfe34ebaa7031804a5/bin/Debug/net7.0-ios/ios-arm64/device-builds/iphone12.8-16.4.1/MauiApp.app' on the device 'iPhone SE 2020': AMDeviceSecureInstallApplicationBundle returned: 0xe8008015.

So my Original question is .. Solved .. but I still haven't reached my goal of being able to deploy?

Update 1:

As a last resort I tried Automatic provisioning again (which is what seemed to have caused the problems initially).

But now using Ventura with Xcode 14.3 (as there was some warning that I could not build for IOS 16.4.1 using Xcode 14.2 on Monterey.

This time it .. WORKED!!! I could deploy to my iPhone.

However - I ended up with an 'Apple Development Created by API' 'Apple Development' certificate when I'd wanted an 'Apple Distribution' certificate.

The provisioning profile and certificate VS 2022 auto-created that finally worked:

Profile:"VS: com.mycompany.mauiapp" Development  Platform: IOS  Type: Development (6 devices)
Certificate:   Name: "Created via API"  (Development) 

The ones I created manually:

Profile: "Maui Dist App Stor Prov Profile"  type: App Store  Platform: IOS  Type: Distribution (No Devices)
Certificate:   Name: "My Name" (Distribution)

So I would still like to know how to create a Distribution cert and profile using Automatic Provisioning as it seems to Only create Development certs and provisioning?

And whether having No Devices in the profile I manually created caused my problem with deploying

Upvotes: 0

Related Questions