Azure Pipeline for Xamarin Forms iOS 在 Nuget 还原时失败

Azure Pipeline for Xamarin Forms iOS Fails at Nuget Restore

我整天都在到处搜索,试图让这个管道工作。

它启动管道,我的任务似乎 运行 正常,直到我为我的解决方案点击 nuget restore。它失败了:

Unable to locate executable file: 'mono'

我不知道为什么会这样。我正在使用 macOS 最新的 vm 图像,我正在使用这个任务来设置单声道版本:

- task: Bash@3
  inputs:
    targetType: 'inline'
    script: |
      SYMLINK=6_8_0_123
      MONOPREFIX=/Library/Frameworks/Mono.framework/Versions/$SYMLINK
      echo "##vso[task.setvariable variable=DYLD_FALLBACK_LIBRARY_PATH;]$MONOPREFIX/lib:/lib:/usr/lib:$DYLD_LIBRARY_FALLBACK_PATH"
      echo "##vso[task.setvariable variable=PKG_CONFIG_PATH;]$MONOPREFIX/lib/pkgconfig:$MONOPREFIX/share/pkgconfig:$PKG_CONFIG_PATH"
      echo "##vso[task.setvariable variable=PATH;]$MONOPREFIX/bin:$PATH"

我可以设置其他东西让 Nuget 找到单声道库吗?

谢谢。

Azure Pipeline for Xamarin Forms iOS Fails at Nuget Restore

根据报错信息:

Unable to locate executable file: 'mono'

目前似乎尚未实施 NuGet 任务以在该代理 (macOS-latest) 上运行。

要解决上述错误,我们可以使用 .NET Core (dotnet restore) 任务而不是 nuget 恢复任务。

这个具体案例的最终解决方案:

感谢 jmichas 的分享。使用 .NET Core (dotnet restore) 任务确实可以解决该错误。但是,它在特定情况下带来了其他错误的冲击。这种特定情况的最终解决方案是在 xamarin ios 构建任务中使用 runNugetRestore

- task: XamariniOS@2
  inputs:
     runNugetRestore: true

希望这对其他人有帮助。