Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure DevOps Build Xamarin.IOS with IOS 12 as target

I have an Application written with Xamarin and a buildpipline on Azure Devops. This builds fine when I target IOS 11.x. However I would like to update to SDK 12 since Apple starts to enforce this starting in march 2019:

SDK Version Issue - This app was built with the iOS 11.4 SDK. Starting March 2019, all iOS apps submitted to the App Store must be built with the iOS 12.1 SDK or later, included in Xcode 10.1 or later.

But when I build I always get this error in my Azure Devops pipeline:

MTOUCH : error MT0074: Xamarin.iOS 11.14.0 does not support a deployment target of 12.0 for iOS (the maximum is 11.4). Please select an older deployment target in your project's Info.plist or upgrade to a newer version of Xamarin.iOS.

Based on this article I tried to set the SDK Version with this script:

 /bin/bash -c "sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 5_12_0"

Unfortunately it still uses the 11 SDK instead of 12. Did I choose the wrong Mono Version or is that the wrong approach to select the Xamarin.IOS SDK?

My complete build YAML for the IOS Job:

queue:
  name: Hosted macOS
  demands: 
  - xcode
  - Xamarin.iOS

steps:
- bash: |
   echo "Select Xamarin Version"
    /bin/bash -c "sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 5_12_0"
  displayName: 'Select Xamarin Version'

- task: InstallAppleCertificate@2
  displayName: 'Install an Apple certificate'
  inputs:
    certSecureFile: '6f1c094d-c147-41e0-9bc6-c9fe9a40b2e6'

    certPwd: '$(P12password)'


- task: InstallAppleProvisioningProfile@1
  displayName: 'Install an Apple provisioning profile'
  inputs:
    provProfileSecureFile: 'a883a983-6027-4382-afd4-94b52736323c'


- task: NuGetToolInstaller@0
  displayName: 'Use NuGet'
  inputs:
    versionSpec: 4.x


- task: NuGetCommand@2
  displayName: 'NuGet restore'
  inputs:
    restoreSolution: '$(Parameters.solution)'


- task: XamariniOS@2
  displayName: 'Build Xamarin.iOS '
  inputs:
    solutionFile: Src/MoneyFox.Ios/MoneyFox.iOS.csproj

    configuration: '$(BuildConfiguration)'
like image 302
NPadrutt Avatar asked Dec 17 '18 08:12

NPadrutt


2 Answers

You should be able to select the correct version of Mono and Xcode now based on this documentation. In Azure DevOps in both the build and the release pipelines (before the Xamarin.iOS build task and the release task respectively), I added a command line task that runs the following:

echo 'Updating fastlane...'
sudo gem install fastlane

echo 'Selecting Mono version...'
/bin/bash -c "sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 5_16_0"

echo 'Selecting Xcode version...'
/bin/bash -c "echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_10.1.app;sudo xcode-select --switch /Applications/Xcode_10.1.app/Contents/Developer"
like image 61
Daniel Miller Avatar answered Sep 25 '22 10:09

Daniel Miller


In case it helps: the build SDK and the deployment target are different things. I'm building using the 12.1 SDK, but my deployment target, and minimum OS version, are both set to 8.0.

like image 24
Chandler Zwolle Avatar answered Sep 25 '22 10:09

Chandler Zwolle