首页 > 解决方案 > CI 无法构建 .NET 项目,失败并显示:“找不到安装在系统上的有效 ICU 包...”

问题描述

我正在努力让 Jenkins 构建我们遗留的 .NET 2.1 应用程序,作为简化 kubernetes 部署的一部分

因此,我创建了一个基于 jenkins/jnlp-slave:latest-jdk11 docker 镜像 ( https://github.com/jenkinsci/docker-jnlp-slave ) 的自定义 Jenkins 代理,它又基于 Debian 9,扩展了官方的 .NET Core(从https://dotnet.microsoft.com/download/dotnet-core/2.1解压 ZIP ,Debian 更新不适用于我们的防火墙),对于琐碎的项目,它运行良好。

现在我尝试使用一个真正的遗留应用程序,该应用程序在从命令行运行命令时构建良好,但是当 Jenkins 尝试运行dotnet restore -v n构建时立即失败:

+ dotnet restore -v n
11:11:29  FailFast:
11:11:29  Couldn't find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support.
11:11:29  
11:11:29     at System.Environment.FailFast(System.String)
11:11:29     at System.Globalization.GlobalizationMode.GetGlobalizationInvariantMode()
11:11:29     at System.Globalization.GlobalizationMode..cctor()
11:11:29     at System.Globalization.CultureData.CreateCultureWithInvariantData()
11:11:29     at System.Globalization.CultureData.get_Invariant()
11:11:29     at System.Globalization.CultureInfo..cctor()
11:11:29     at System.StringComparer..cctor()
11:11:29     at System.AppDomain.InitializeCompatibilityFlags()
11:11:29     at System.AppDomain.Setup(System.Object)
11:11:29  Aborted (core dumped)

对 .NET 不是很有经验,我可能在设置环境时错过了某个步骤。该应用程序需要在“da-DK”语言环境中运行。

我了解缺少某些部分。这应该如何解决?我对项目特定的快速解决方案和长期代理特定的解决方案都感兴趣。

标签: c#jenkins.net-coredebian

解决方案


在下载页面上找到https://docs.microsoft.com/da-dk/dotnet/core/tools/dotnet-install-script并看到“需要的依赖项”链接与安装脚本的输出相结合后,我发现根本原因是缺少库依赖,修复方法是安装在 Dockerfile 中。

# Needed dependencies...
RUN apt install -y libunwind8 libicu57

推荐阅读