Xamarin.Android 支持 GithubActions 工作流程? (或如何以编程方式安装 JDK)

Xamarin.Android support with GithubActions workflows? (or how to install JDK programmatically)

我正在尝试使用由 GithubActions 工作流程(标记为 windows-latest)生成的 WindowsVM 构建一个 Xamarin.Android 库,但我收到此错误:

C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(798,2): error XA5300: The Java SDK Directory could not be found. Please set via /p:JavaSdkDirectory.

如何在调用构建脚本之前以编程方式将 VisualStudio Xamarin 工具安装到此 VM 中?恐怕只安装 Java SDK(按照错误指示)可能无法真正解决它。

(我正在从 AzureDevOps 迁移到 GithubActions;这与前者开箱即用,无需在 buildagent 配置上指定任何内容。)

Xamarin.Android 10.x 来自 Visual Studio 2019 16.3 已修复此问题,不幸的是,您需要在构建期间下载并安装它——它刚刚发布!

使用 boots 时,我已经能够在 Github 操作上构建 Xamarin.Android 项目,如本例所示:https://github.com/jonathanpeppers/boots#github-actions