Archive with xcodebuild / Xcode 14 and manual signing not possible

We are building out app on a Azure Devops CI server. Therefore we are using the Xcode@5 Task, which results in the following command:

/usr/bin/xcodebuild -workspace /Redacted/project.xcworkspace -scheme Redacted archive -sdk iphoneos -configuration Release -archivePath Redacted.xcarchive CODE_SIGN_STYLE=Manual CODE_SIGN_IDENTITY=Redacted PROVISIONING_PROFILE=Redacted PROVISIONING_PROFILE_SPECIFIER=

This is (one of) the output / failures:

Redacted/Package.swift: error: Redacted does not support provisioning profiles. Redacted does not support provisioning profiles, but provisioning profile Redacted has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target __'Redacted'__ from project 'Redacted').

So, there seems to be an error while signing contained swift packages. With Xcode 13.4.1 the command is working. Any ideas what is going wrong here?

Note: Without signing, everything works as expected. Unfortunately. But that's not what we need.

FYI: FB11402077

I'm experiencing a similar issue since upgrading to Xcode 14.0 Build version 14A309.

Building from the command line with xcodebuild works, but xcodebuild archive always fails.

This succeeds:

xcodebuild -workspace ./Redacted.xcworkspace -scheme Redacted -configuration Release -destination generic/platform=iOS -allowProvisioningUpdates

This fails:

xcodebuild -workspace ./Redacted.xcworkspace -scheme Redacted -configuration Release -destination generic/platform=iOS -archivePath "/Users/username/Library/Developer/Xcode/Archives/2022-09-26/Redacted_2022-09-26_14.01.09.xcarchive" -allowProvisioningUpdates archive

There are no errors emitted that can explain the ** ARCHIVE FAILED ** message. Specifically, there is no error reported by CodeSign.

These are the last few lines of the build log:

 CodeSign /Users/username/Library/Developer/Xcode/DerivedData/Redacted-dbsslheqkuqpbggxvwaiakaabivh/Build/Intermediates.noindex/ArchiveIntermediates/Redacted/InstallationBuildProductsLocation/Applications/Redacted.app (in target 'Redacted' from project 'Redacted')
    cd /Users/username/dev/Redacted-ios

    Signing Identity:     "Apple Development: Redacted (8C3XJJ4HV9)"
    Provisioning Profile: "iOS Team Provisioning Profile: com.Redacted.Redacted"
                          (Redacted)

    /usr/bin/codesign --force --sign Redacted --entitlements /Users/username/Library/Developer/Xcode/DerivedData/Redacted-dbsslheqkuqpbggxvwaiakaabivh/Build/Intermediates.noindex/ArchiveIntermediates/Redacted/IntermediateBuildFilesPath/Redacted.build/Release-iphoneos/Redacted.build/Redacted.app.xcent --generate-entitlement-der /Users/username/Library/Developer/Xcode/DerivedData/Redacted-dbsslheqkuqpbggxvwaiakaabivh/Build/Intermediates.noindex/ArchiveIntermediates/Redacted/InstallationBuildProductsLocation/Applications/Redacted.app

RegisterExecutionPolicyException /Users/username/Library/Developer/Xcode/DerivedData/Redacted-dbsslheqkuqpbggxvwaiakaabivh/Build/Intermediates.noindex/ArchiveIntermediates/Redacted/InstallationBuildProductsLocation/Applications/Redacted.app (in target 'Redacted' from project 'Redacted')
    cd /Users/username/dev/Redacted-ios
    builtin-RegisterExecutionPolicyException /Users/username/Library/Developer/Xcode/DerivedData/Redacted-dbsslheqkuqpbggxvwaiakaabivh/Build/Intermediates.noindex/ArchiveIntermediates/Redacted/InstallationBuildProductsLocation/Applications/Redacted.app

Validate /Users/username/Library/Developer/Xcode/DerivedData/Redacted-dbsslheqkuqpbggxvwaiakaabivh/Build/Intermediates.noindex/ArchiveIntermediates/Redacted/InstallationBuildProductsLocation/Applications/Redacted.app (in target 'Redacted' from project 'Redacted')
    cd /Users/username/dev/Redacted-ios
    builtin-validationUtility /Users/username/Library/Developer/Xcode/DerivedData/Redacted-dbsslheqkuqpbggxvwaiakaabivh/Build/Intermediates.noindex/ArchiveIntermediates/Redacted/InstallationBuildProductsLocation/Applications/Redacted.app

Touch /Users/username/Library/Developer/Xcode/DerivedData/Redacted-dbsslheqkuqpbggxvwaiakaabivh/Build/Intermediates.noindex/ArchiveIntermediates/Redacted/InstallationBuildProductsLocation/Applications/Redacted.app (in target 'Redacted' from project 'Redacted')
    cd /Users/username/dev/Redacted-ios
    /usr/bin/touch -c /Users/username/Library/Developer/Xcode/DerivedData/Redacted-dbsslheqkuqpbggxvwaiakaabivh/Build/Intermediates.noindex/ArchiveIntermediates/Redacted/InstallationBuildProductsLocation/Applications/Redacted.app

** ARCHIVE FAILED **

Is this a known issue in Xcode 14?

Note: Archiving from Xcode IDE works just fine, including export/signing.

I do not believe Azure Dev Ops CI supports Xcode 14.0 yet, some feature may just break.

Archive with xcodebuild / Xcode 14 and manual signing not possible
 
 
Q