Skip to main content

Fix newer deployment target error for .NET MAUI when upgrading to .NET 9

·2 mins

While building my white label conference app, I decided to update it to .NET 9. But after doing so I ended up with a build error! In this short post I’ll tell you how to fix it if this happens to you, as it probably will!

What is the build error? #

The build error will look like this:

ILLink : unknown error IL7000: An error occured while executing the custom linker steps. Please review the build log for more information. ILLINK : error MT0073: Microsoft.iOS 17.5.9270 does not support a deployment target of 11.0 for iOS (the minimum is 12.2). Please select a newer deployment target in your project’s Info.plist. ILLINK : error MT2301: The linker step ‘Setup’ failed during processing: Microsoft.iOS 17.5.9270 does not support a deployment target of 11.0 for iOS (the minimum is 12.2). Please select a newer deployment target in your project’s Info.plist. /Users/jfversluis/.nuget/packages/microsoft.net.illink.tasks/9.0.0-rc.1.24431.7/build/Microsoft.NET.ILLink.targets(96,5): error NETSDK1144: Optimizing assemblies for size failed.

The .NET 9 version might be different, I tried this with RC1, the Microsoft.iOS version might be different, but the rest will probably be the same.

The .NET for iOS SDK has updated their minimum deployment target from 11.0 to 12.2. And this error message tells you exactly what to do: update the Info.plist file!

However…

Fix MT0073/MT2301 for .NET MAUI #

If you go look in your Info.plist file for your .NET MAUI app, there is a big chance that you don’t see any values that have to do with deployment targets!

The error message originates from the .NET for iOS layer and checks out: the value for the minimum deployment target is set in the Info.plist file, but for a .NET MAUI app it works slightly different.

For a .NET MAUI app, those values are specified in your csproj file and at compile time those are inserted in your Info.plist file for you. So to fix this for your .NET MAUI app, open your .NET MAUI project csproj file and find the following line:

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>

You will want to update the value 11.0 to be at least 12.2 now as indicated by the error message. If you do that, save your csproj file and rebuild, the error should go away!