I have a MAUI app that targets net8.0-ios
. On my local dev machine (and remotely connected mac), I'm able to build against iOS SDK 18 with Xcode 16. In Azure DevOps, I've specified
macos-14
as the agent image, but it's complaining about using iOS 17.5 instead of 18.0.
ILLINK : error MT2362: The linker step 'ClassHandleRewriter' failed during processing: One or more errors occurred. (The type 'MapKit.MKSelectionAccessory' (used as a return type in MapKit.MKMapView/_MKMapViewDelegate.GetSelectionAccessory) is not available in iOS 17.5 (it was introduced in iOS 18.0). Please build with a newer iOS SDK (usually done by using the most recent version of Xcode). [/Users/runner/work/1/s/App/App.csproj::TargetFramework=net8.0-ios]
The important part of that is:
... is not available in iOS 17.5 (it was introduced in iOS 18.0). Please build with a newer iOS SDK (usually done by using the most recent version of Xcode)
How do I tell DevOps to use iOS 18? I checked the agent specs, and it has iOS 18 and Xcode 16.
Starting: Initialize job
Agent name: 'Hosted Agent'
Agent machine name: 'Mac-1727975076930'
Current agent version: '3.245.0'
Operating System
Runner Image
Image: macos-14
Version: 20240923.101
Included Software: https://github.com/actions/runner-images/blob/macos-14/20240923.101/images/macos/macos-14-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/macos-14%2F20240923.101
Here's the ios stage of my pipeline yaml:
- stage: publish_ios
dependsOn: []
condition: and(succeeded(), in(variables['Environment'], 'QA', 'Production'))
jobs:
- job: BuildMAUIApps
displayName: Build
pool:
vmImage: 'macos-14'
demands:
- MSBuild
steps:
# https://docs.microsoft.com/en-us/azure/devops/pipelines/apps/mobile/app-signing?view=azure-devops&tabs=apple-install-during-build#sign-your-apple-ios-macos-tvos-or-watchos-app
# Setup Secret Pipeline Variable or Library Secrets Variable for iOS Certificate Password
- task: InstallAppleCertificate@2
inputs:
certSecureFile: 'iOS-Distribution.p12'
certPwd: '$(CertificatePassword)'
keychain: 'temp'
- task: InstallAppleProvisioningProfile@1
inputs:
provisioningProfileLocation: 'secureFiles'
provProfileSecureFile: 'app.mobileprovision'
- task: UseDotNet@2
displayName: install dotnet
inputs:
packageType: 'sdk'
version: $(dotnetVersion)
- task: Bash@3
displayName: install maui
inputs:
targetType: 'inline'
script: |
dotnet nuget locals all --clear
dotnet workload install maui --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json --source https://api.nuget.org/v3/index.json
dotnet workload install ios maui wasm-tools --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json --source https://api.nuget.org/v3/index.json
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: 'restore'
feedsToUse: 'config'
nugetConfigPath: 'nuget.config'
externalFeedCredentials: 'https://pkgs.dev.azure.com/org/_packaging/org/nuget/v3/index.json'
# https://docs.microsoft.com/en-us/dotnet/maui/ios/deployment/overview
- task: DotNetCoreCLI@2
displayName: 'dotnet publish'
inputs:
command: 'publish'
publishWebProjects: false
projects: '**/App.csproj'
arguments: '--configuration $(buildConfiguration) --framework net8.0-ios -p:CodesignProvision=$(APPLE_PROV_PROFILE_UUID) -p:ArchiveOnBuild=true -p:Version=$(Build.BuildNumber) -p:ApplicationDisplayVersion=$(Build.BuildNumber) -p:ApplicationVersion=$(Build.BuildId)'
- task: CopyFiles@2
inputs:
Contents: |
**/*.app
**/*.ipa
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'ios'
publishLocation: 'Container'
You can set the Xcode version to Xcode 16.0 with the following script:
- script: |
sudo xcode-select -switch /Applications/Xcode_16.app/Contents/Developer
xcode-select -print-path
xcodebuild -version