通过


适用于 Android 的 .NET 警告 XA1040

示例消息

warning XA1040: The NativeAOT runtime on Android is an experimental feature and not yet suitable for production use. File issues at: https://github.com/dotnet/android/issues

問题

NativeAOT 是适用于 Android 的 .NET 的实验性运行时选项。 通过 $(PublishAot)=true启用 NativeAOT 时,发出此警告以指示 NativeAOT 尚不适合生产使用。

支持的运行时包括:

  • CoreCLR (默认值)
  • 通过 $(UseMonoRuntime)=true 使用的 MonoVM

解决方案

若要静音此警告,可以:

  • 使用受支持的运行时,请通过从项目文件中删除 $(PublishAot)=true

  • $(EnablePreviewFeatures) 设置为 true 以在项目文件中确认 NativeAOT 的实验性质。