3
votes

I have created a YAML build configuration for my Xamarin iOS app and have provided the certificate files ( p12 and mobileprovision ) but when the pipeline runs, it fails on the build step for the app. The installation for the certificates pass.

Note the build with same cert files and password work fine on App Center

In DevOps I get the below error:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(646,3): error : No valid iOS code signing keys found in keychain. You need to request a codesigning certificate from https://developer.apple.com. [/Users/vsts/agent/2.150.3/work/1/s/AwesomeApp/AwesomeApp.iOS/AwesomeApp.iOS.csproj]

Below is my yaml in Azure DevOps:

- job: iOS
pool:
  vmImage: 'macos-latest'

steps:
- script: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 5_12_0
  displayName: 'Select the Xamarin SDK version'
  enabled: false

- task: NuGetToolInstaller@0

- task: NuGetCommand@2
  inputs:
    restoreSolution: '**/*.sln'

- task: InstallAppleProvisioningProfile@1
  inputs:
    provisioningProfileLocation: 'secureFiles'
    provProfileSecureFile: 'iOS_Distribution.mobileprovision'

- task: InstallAppleCertificate@2
  inputs:
    certSecureFile: 'ios_distribution.p12'
    certPwd: '$(p12-password)'
    keychain: 'temp'

- task: XamariniOS@2
  inputs:
    solutionFile: '**/*.sln'
    configuration: 'Ad-Hoc'
    buildForSimulator: false
    packageApp: false

I have tried various different options on the yaml but still get the error.

1

1 Answers

5
votes

Should you not set the properties like this:

- task: InstallAppleCertificate@2
    inputs:
    certSecureFile: 'ios_distribution.p12'
    certPwd: '$(P12password)'
    keychain: 'temp'

- task: InstallAppleProvisioningProfile@1
    inputs:
    provisioningProfileLocation: 'secureFiles'
    provProfileSecureFile: 'iOS_Distribution.mobileprovision'

- task: XamariniOS@2
    displayName: Build iOS App 
    inputs:
    solutionFile: '$(SolutionFile)'
    configuration: '$(BuildConfiguration)'
    buildForSimulator: false
    packageApp: true
    # This value is automatically set by the InstallAppleCertificate task
    signingIdentity: $(APPLE_CERTIFICATE_SIGNING_IDENTITY)
    # This value is automatically set by the InstallAppleProvisioningProfile task
    signingProvisioningProfileID: $(APPLE_PROV_PROFILE_UUID)

The key bit here is the signingIdentity and signingProvisioningProfileID on the XamariniOS@2 task.