Android용 .NET 오류 XA1044

예제 메시지

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.

이 메시지에서 제안하는 조건은 Mono를 지원하는 대상에만 적합합니다. .NET 11 $(UseMonoRuntime)=true 에서는 NETSDK1242 사용하여 거부됩니다. 대신 Mono 전용 속성을 제거합니다.

Issue

이 오류는 프로젝트 파일에서 Mono 관련 MSBuild 속성이 설정되어 있지만 프로젝트가 CoreCLR 또는 NativeAOT와 같은 Mono가 아닌 런타임을 사용하도록 구성되었음을 나타냅니다. 속성이 true이면 빌드는 이를 false로 다시 설정하여 Mono가 아닌 빌드 단계로 전달되지 않도록 한 다음 XA1044와 함께 중지합니다. 이것은 경고도 아니고, 조용히 아무 동작도 하지 않는 것도 아닙니다.

CoreCLR 애플리케이션의 경우 false를 RunAOTCompilation로 설정하면 이 오류도 발생합니다. ReadyToRun 컴파일을 비활성화하지 않습니다. NativeAOT로 false 설정해도 이 오류가 발생하지 않습니다.

이 오류를 트리거하는 속성은 다음과 같습니다.

  • RunAOTCompilation — Mono AOT 컴파일을 사용하도록 설정합니다.
  • EnableLLVM — Mono AOT 컴파일러에 LLVM을 사용하도록 설정합니다.

해결 방법

프로젝트 파일 또는 Directory.Build.props.에서 Mono 관련 속성을 제거합니다. 지원되는 .NET 10 및 이전 Mono 대상에만 적용되는 프로젝트 파일 또는 조건에서만 유지합니다.

ReadyToRun 및 NativeAOT는 별도의 컴파일 모델입니다. Mono AOT 설정을 일대일로 대체하지는 않습니다.

.NET 11부터 CoreCLR 애플리케이션에 대해 R2R(ReadyToRun) AOT 컴파일을 사용하지 않도록 설정하려면 RunAOTCompilation를 제거하고 설정하려면 PublishReadyToRun 대신 false으로:

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