CI cannot build .NET project, fails with: “Couldn't find a valid ICU package installed on the system…”

隐身守侯 提交于 2021-01-28 20:11:06

问题


I am working on having Jenkins build our legacy .NET 2.1 applications as part of streamlining our kubernetes deployments

Therefore I have created a custom Jenkins agent based on the jenkins/jnlp-slave:latest-jdk11 docker image (https://github.com/jenkinsci/docker-jnlp-slave) which in turn is Debian 9 based, extended with the official .NET Core (unpacked the ZIP from https://dotnet.microsoft.com/download/dotnet-core/2.1 , Debian updates does not work well with our firewall), and for trivial projects this has worked well.

Now I try with a real legacy application which builds nicely when running the commands from the command line, but when Jenkins try to run dotnet restore -v n the build immediately fails with:

+ 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)

Not being very experienced with .NET, I have probably missed a step somewhere when setting up the environment. The application needs to run in the "da-DK" locale.

I understand that some part is missing. How should this fixed? I am interested in both project-specific quick solutions and long-term agent-specific solutions.


回答1:


After locating https://docs.microsoft.com/da-dk/dotnet/core/tools/dotnet-install-script on the download page, and seeing the "needed dependencies" link combined with the output from the install script, I found that the underlying reason was missing library dependencies, and the fix was to install them in the Dockerfile.

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


来源:https://stackoverflow.com/questions/58132275/ci-cannot-build-net-project-fails-with-couldnt-find-a-valid-icu-package-ins

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!