使用英语阅读

通过


适用于 Android 的 .NET 错误 XA1030

示例消息

The 'RunAOTCompilation' MSBuild property is only supported when trimming is enabled. Edit the project file in a text editor to set 'PublishTrimmed' to 'true' for this build configuration.

解决方案

而不是使用:

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
  <RunAOTCompilation>true</RunAOTCompilation>
  <!-- Either of these disable the linker/trimmer -->
  <PublishTrimmed>false</PublishTrimmed>
  <AndroidLinkMode>None</AndroidLinkMode>
</PropertyGroup>

请改为使用默认值$(PublishTrimmed)$(AndroidLinkMode)

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

此外,如前所述 XA0119,不应 $(RunAOTCompilation) 在配置中使用 Debug