无法构建 Xamarin.Forms iOS 项目

Cannot build Xamarin.Forms iOS project

我正在尝试在 Azure DevOps 上构建我们的 Xamarin.Forms 应用程序,但它因 iOS 失败并出现以下错误:

Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.1.sdk/System/Library/Frameworks/Photos.framework/Headers/PHImageManager.h(18,2): error GB12A9FDE: "Photos requires C++11 or later" [/Users/runner/runners/2.159.2/work/1/s/My_MobileApp/My_MobileApp.iOS/My_MobileApp.iOS.csproj]

该应用程序最初是在 VS 2017 上创建的,然后迁移到 VS 2019。它工作正常,但由于某种原因昨天停止构建。

我该如何解决?

好的,已解决:

我们使用以下内联脚本在 xamarin.ios 构建任务之前添加了一个命令行任务:

/bin/bash -c "echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'$(xcode.root);sudo xcode-select --switch $(xcode.root)/Contents/Developer"

并将名为 xcode.root 的变量设置为 /Applications/Xcode_10.3.app 以覆盖构建代理上 xcode 的错误版本 这有点 hacky,所以一旦问题在上游得到解决,我们将需要删除该覆盖。