I submitted a TSI to Apple after closing of the feedback.
The answer was, that when passing PROVISIONING_PROFILE_SPECIFIER or PROVISIONING_PROFILE to xcodebuild, that setting is applied every target that subsequently built for Xcode 14 (as known...). The suggested approach was to set these vars not via xcodebuild, but instead setting them to each target individually. This led us to our solution:
We set the PROVISIONING_PROFILE_SPECIFIER etc. to custom vars, here MY_ PROVISIONING_PROFILE_SPECIFIER in build settings. Then we passed them via args. These are the corresponding lines from our Azure Devobs job.
- task: InstallAppleCertificate@2
displayName: 'Install Apple Certificates'
inputs:
certSecureFile: ${{ parameters.ADHOC_CERTIFICATE }}
certPwd: ${{ parameters.ADHOC_CERTIFICATE_PASSWORD }}
keychain: 'temp'
- task: InstallAppleProvisioningProfile@1
displayName: 'Install Apple Provisioning Profile'
inputs:
provisioningProfileLocation: 'secureFiles'
provProfileSecureFile: ${{ parameters.ADHOC_PROVISIONING_PROFILE }}
- task: Bash@3
displayName: 'Build exportOptions.plist file'
inputs:
targetType: 'inline'
script: |
/usr/libexec/PlistBuddy -c "Add :method string ad-hoc" $(system.defaultworkingdirectory)/export.plist
/usr/libexec/PlistBuddy -c "Add :provisioningProfiles dict" $(system.defaultworkingdirectory)/export.plist
/usr/libexec/PlistBuddy -c "Add :provisioningProfiles:${{ parameters.ADHOC_BUNDLE_ID }} string $(APPLE_PROV_PROFILE_UUID)" $(system.defaultworkingdirectory)/export.plist
/usr/libexec/PlistBuddy -c "Add :signingCertificate string $(APPLE_CERTIFICATE_SIGNING_IDENTITY)" $(system.defaultworkingdirectory)/export.plist
/usr/libexec/PlistBuddy -c "Add :signingStyle string manual" $(system.defaultworkingdirectory)/export.plist
/usr/libexec/PlistBuddy -c "Add :teamID string ${{ parameters.ADHOC_TEAM_ID }}" $(system.defaultworkingdirectory)/export.plist
...
- task: Xcode@5
displayName: 'Build and Archive'
inputs:
# Currently, Xcode 13 is the default. Therefore, the version needs to be changed to Xcode 14.
xcodeVersion: 'specifyPath'
xcodeDeveloperDir: '/Applications/Xcode_14.0.app'
# By default, 'packageApp: true' will already build and archive the app so don't do anything here.
# https://developercommunity.visualstudio.com/content/problem/1222720/why-is-xcode-ado-task-building-our-ios-project-twi.html
actions: 'clean'
scheme: ${{ parameters.SCHEME }}
sdk: ${{ parameters.SDK }}
configuration: 'Release'
xcWorkspacePath: '**/*.xcodeproj/project.xcworkspace'
signingOption: 'default'
packageApp: true
archivePath: '$(system.defaultworkingdirectory)/build/${{ parameters.SCHEME }}.xcarchive'
exportPath: '$(system.defaultworkingdirectory)/build'
# At this point we deliberately do not use the parameters signingIdentity and provisioningProfileUuid.
# When we do use them, they are applied to the app and all Swift packages in the app (new since Xcode 14). However, these often do not support signing.
# The parameters passed here are only applied to the app itself (see build setting and project.yml).
args: '-destination generic/platform=iOS -verbose MY_PROVISIONING_PROFILE_SPECIFIER=$(APPLE_PROV_PROFILE_UUID) MY_CODE_SIGN_IDENTITY="$(APPLE_CERTIFICATE_SIGNING_IDENTITY)" MY_DEVELOPMENT_TEAM=${{ parameters.ADHOC_TEAM_ID }}'
exportOptions: 'plist'
exportOptionsPlist: '$(system.defaultworkingdirectory)/export.plist'