When building my .NET 8 iOS MAUI app in an Azure DevOps build pipeline, it complains that I’m not using the latest Xcode.
ILLink : iOS error IL7000: An error occured while executing the custom linker steps. Please review the build log for more information. [/Users/runner/work/1/s/MyProject/MyProject.csproj::TargetFramework=net8.0-iOS]
/Users/builder/azdo/_work/1/s/xamarin-macios/src/build/dotnet/ios/generated-sources/UIKit/UIApplication.g.cs(95): error MT4162: The type 'UIKit.UISceneSessionActivationRequest' (used as a parameter in UIKit.UIApplication.ActivateSceneSession) is not available in iOS 16.4 (it was introduced in iOS 17.0). Please build with a newer iOS SDK (usually done by using the most recent version of Xcode). [/Users/runner/work/1/s/MyProject/MyProject.csproj::TargetFramework=net8.0-iOS]
ILLINK : error MT2362: The linker step 'Registrar' failed during processing: The type 'UIKit.UISceneSessionActivationRequest' (used as a parameter in UIKit.UIApplication.ActivateSceneSession) is not available in iOS 16.4 (it was introduced in iOS 17.0). Please build with a newer iOS SDK (usually done by using the most recent version of Xcode). [/Users/runner/work/1/s/MyProject/MyProject.csproj::TargetFramework=net8.0-iOS]
I’ve set up my build pipeline to use macos-latest
but Xcode 15 does not appear to be installed.
Note: I ran into this problem at work and have resolved it, so I’ll include my answer below.
2
Answers
As of December 2023, the
macos-latest
image is Mac OS 12. The list of build agents along with their image names is documented hereQuick screen snip of the relevant image names here:
Step 1 - Use the actual latest image
macos-13
It's in preview as of right now, but it has latest versions of Xcode (15.0 and 15.0.1) installed.
Step 2 - Select Xcode version
I have some yaml in my build pipeline that lists out relevant information and selects the latest version of Xcode that I want to use.
Example output:
This solution effectively ensures that the correct Xcode version 15.0.1 is used during the build process, allowing your .NET 8 iOS MAUI app to compile without encountering errors related to unavailable types from older iOS SDKs.