Edit

.NET for Android error XA1044

Example messages

error XA1044: The MSBuild property 'RunAOTCompilation' is not compatible with the CoreCLR runtime. The build cannot continue while this property is enabled. Either remove the property or guard it with a condition: Condition="'$(UseMonoRuntime)' == 'true'"
error XA1044: The MSBuild property 'RunAOTCompilation' is not compatible with the CoreCLR runtime. The build cannot continue while this property is set to 'false'. Remove the property. Starting with .NET 11, set 'PublishReadyToRun' to 'false' to disable ReadyToRun (R2R) AOT compilation.

The condition suggested by this message is only appropriate for targets that support Mono. In .NET 11, $(UseMonoRuntime)=true is rejected with NETSDK1242; remove the Mono-only property instead.

Issue

This error indicates that a Mono-specific MSBuild property is set in the project file, but the project is configured to use a non-Mono runtime, such as CoreCLR or NativeAOT. When the property is true, the build resets it to false so it is not passed to non-Mono build steps, then stops with XA1044. This is not a warning or a silent no-op.

For CoreCLR applications, setting RunAOTCompilation to false also produces this error. It does not disable ReadyToRun compilation. Setting it to false for NativeAOT does not produce this error.

Properties that trigger this error include:

  • RunAOTCompilation — Enables Mono AOT compilation.
  • EnableLLVM — Enables LLVM for the Mono AOT compiler.

Solution

Remove the Mono-specific property from your project file or Directory.Build.props. Retain it only in project files or conditions that apply exclusively to supported .NET 10-and-earlier Mono targets.

ReadyToRun and NativeAOT are separate compilation models. They are not one-to-one replacements for Mono AOT settings.

Starting with .NET 11, to disable ReadyToRun (R2R) AOT compilation for CoreCLR applications, remove RunAOTCompilation and set PublishReadyToRun to false instead:

<PropertyGroup>
  <PublishReadyToRun>false</PublishReadyToRun>
</PropertyGroup>