Description:
When compiling a .NET MAUI app for iOS, I encounter the following error:
ILLINK : error MT2301: The linker step 'Setup' failed during processing: This version of Microsoft.iOS requires the iOS 18.0 SDK (shipped with Xcode 16.0). Either upgrade Xcode to get the required header files or set the managed linker behaviour to Link Framework SDKs Only in your project's iOS Build Options > Linker Behavior (to try to avoid the new APIs).
Previously, my app was built with .NET 8.0 and everything worked fine. However, something seems to have changed with MAUI, because now I am encountering this error on the same machine where it was previously working without issues.
The build fails with the linker error MT2301, stating that Microsoft.iOS requires iOS 18.0 SDK (which comes with Xcode 16.0), and suggesting either upgrading Xcode or changing the linker behavior.
Upgrading to Xcode 16.0 is not an option for my setup. I would like to know if there is a workaround to bypass this issue while staying on Xcode 15.2 and iOS SDK 17.2. Any guidance would be appreciated.
Thank you!
The project should compile successfully without requiring an upgrade to Xcode 16.0.
Here is a related issue on GitHub, ILLINK errors when compiling MAUI apps on Mac - says targeting version that I'm not.
@jaysidri share a workaround pinning the workload version did the trick and you may have a try.
However we still recommend use the latest Visual Studio2022 (Visual Studio for Mac retire) and .NET SDK and upgrade XCode as the error message said.
For more info, you may also refer to .NET SDK workload sets.