【问题标题】:Jenkins cannot build Xamarin iOS project over a missing reference to assembly netstandardJenkins 无法通过缺少对程序集 netstandard 的引用来构建 Xamarin iOS 项目
【发布时间】:2018-09-20 19:04:51
【问题描述】:

我正在尝试使用 Jenkins 为 Xamarin iOS 项目构建 CI 管道,但我遇到了错误,因为 MSBuild 找不到对 .NET 标准库的引用:

IDebugSettingService.cs(8,22): error CS0012: The type 'IDisposable' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
ViewModels/IPresentationTabViewModel.cs(17,15): error CS0012: The type 'MulticastDelegate' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
ViewModels/ICredentials.cs(17,10): error CS0012: The type 'Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.

我可以在 Mac 构建机器上使用我的帐户成功构建项目,但 Jenkins 服务帐户在这里总是失败。我已经尝试清除和恢复所有 NuGet 包,但 MSBuild 日志并没有太大帮助,尽管使用 Jenkins 运行时 MSBuild 加载的程序集似乎比我运行时少得多。

这是我的项目设置方式的问题,还是 Jenkins 的问题?

【问题讨论】:

  • 使用运行 jenkins 构建的同一用户,您可以使用自己的命令行构建项目吗?
  • @gunr2171 运行 Jenkins 构建的用户是服务帐户,所以很遗憾我无法登录。
  • 您正在为构建运行什么命令? msbuild 还是 dotnet?您是否安装了 .net 核心运行时?
  • @gunr2171 我运行msbuild BlipBlop.sln /p:Configuration=Ad-Hoc /p:Platform=iphone /p:Buildipa=true。解决方案中仅有的两个项目是 .NET Standard 项目和 iOS 项目。 .NET core 2.1.302根据dotnet --version命令安装。

标签: c# ios xamarin jenkins msbuild


【解决方案1】:

事实证明,Jenkins 帐户上的 PATH 环境变量缺少 /usr/local/share/dotnet 路径,因此无法访问 NuGetFallbackFolder(NETStandard.Library 引用所在的位置)。

/usr/local/share/dotnet 添加到PATH 修复了构建。

【讨论】:

    【解决方案2】:

    像我添加的一样添加 $Path

    Path=/Library/Frameworks/Mono.framework/Versions/Current/Commands:$Path:/usr/local/share/dotnet
    

    【讨论】:

    • 如果你们需要 jenkins 的任何帮助,请告诉我。我知道这对初学者来说很难。
    猜你喜欢
    • 2020-04-22
    • 1970-01-01
    • 2018-11-06
    • 1970-01-01
    • 2020-05-10
    • 2021-11-08
    • 1970-01-01
    • 1970-01-01
    • 2017-08-07
    相关资源
    最近更新 更多