.NET for Android 警告 XA1029

示例消息

warning XA1029: The 'AotAssemblies' MSBuild property is deprecated. Edit the project file in a text editor to remove this property, and use the 'RunAOTCompilation' MSBuild property instead.

问题

每当指定 时,都会触发此警告,包括将其设置为 时。

解决方案

对于使用 Mono 的受支持的 .NET 10 及更早版本项目,请不要使用:

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
  <AotAssemblies>true</AotAssemblies>
</PropertyGroup>

请改用:

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
  <RunAOTCompilation>true</RunAOTCompilation>
</PropertyGroup>

对于 CoreCLR 或 NativeAOT 项目,请删除 $(AotAssemblies) 而不添加 $(RunAOTCompilation)。 这些运行时不使用 Mono AOT 流程。 如果 $(AotAssemblies) 为 true,而 $(RunAOTCompilation) 未设置或为 true,则转发会产生导致构建停止的 XA1044 错误。