0

I am using visual studio 2017 (15.6.5) and have a .NET standard based xamarin solution which contains an android and iOS project.

I am using visual studio online CI to (try) to build the iOS application. All works fine in development. I am satisfied that I have the certificates, apps, devices and provisioning profiles correctly set up.

I cannot build using visual studio online. When we get the part where the p12 certificate is imported into the temporary keychain, I get the error

security: SecKeychainItemImport: Unknown format in import.

I am using the preview mac agent provided by VSTS. I am using MSBuild as the build agent options. I am storing the p12 certificate as a blob and using curl to download.

when running the commands

/usr/bin/security create-keychain -p _xamariniostask_TmpKeychain_Pwd#1 /Users/vsts/agent/2.131.0/work/1/s/_xamariniostasktmp.keychain
/usr/bin/security set-keychain-settings -lut 7200 /Users/vsts/agent/2.131.0/work/1/s/_xamariniostasktmp.keychain
/usr/bin/security unlock-keychain -p _xamariniostask_TmpKeychain_Pwd#1 /Users/vsts/agent/2.131.0/work/1/s/_xamariniostasktmp.keychain
/usr/bin/security import /Users/vsts/agent/2.131.0/work/1/s/FILENAME.p12 -P PASSWORD -A -t cert -f pkcs12 -k /Users/vsts/agent/2.131.0/work/1/s/_xamariniostasktmp.keychain

on my mac build machine, all is well. I am stumped.

I am guessing that

  1. I am not exporting the certificate correctly but it works on the build machine
  2. uploading and downloading from blob storage or from mac to windows via the internet (in order to get it in the blob storage) is causing some corruption?
  3. There is something to do with not being on the same machine

Can anyone help? I am not sure which technology I am failing with?

I creating the P12 certificate using keychain access on the mac by exporting the distribution certificate in "My certificates" and have tried development and distribution certificates created on the apple developer portal. I have exported the "parent" certificate and just the private key. All the same result.

1 Answers1

0

Ignore this. Classic self-rubber ducking here. I discovered that the curl command I was using on the mac agent (which I cannot access) was silently failing. This was downloading the file I needed. I had used an azure blob storage object instead of a "standard object". Hence there was no p12 certificate or provisioning profile. Errors should have been displayed in the curl command or "cannot find file" would have been more useful.

Grrrrr!