0

我在从入站詹金斯代理构建 dotnet 解决方案方面遇到了一些困难。每次,我运行编译器都认为缺少 ICU 包的链。

从互联网上,我确实找到了一些解决方法:

  • 在编译之前设置一个特定的环境变量 export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
  • 在您的 .csproj 中,将 InvariantGlobalization 设置为 true 链接链接
  • 安装 ibicu63,它是 debian链接的 icu 包

我尝试了所有解决方案,但没有一个有效......

我在镜像中安装了 icu 包

自定义入境代理 IMG #1

FROM jenkins/inbound-agent
USER root
RUN apt-get update;
RUN apt install wget
RUN wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
RUN dpkg -i packages-microsoft-prod.deb
RUN rm packages-microsoft-prod.deb
RUN apt-get install -y apt-transport-https && \
  apt-get update && \
  apt-get install -y dotnet-sdk-3.1
USER jenkins

自定义入境代理 IMG #1

FROM jenkins/inbound-agent
USER root
RUN  apt-get update && apt-get install -y libicu63
USER jenkins

我将 invariantGlobalization 设置为 true

CSPROJ

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
    **<InvariantGlobalization>true</InvariantGlobalization>**
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="AspNetCoreRateLimit" Version="4.0.1" />
    <PackageReference Include="AspNetCoreRateLimit.Redis" Version="1.0.0" />
    <PackageReference Include="Dapper" Version="2.0.90" />
    <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.14" />
    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.7" />
  </ItemGroup>
</Project>

我使用了环境变量

管道

pipeline {
    parameters{
        string(name: 'url', description: 'repository url')
        string(name: 'branch', description: 'branch name')
        string(name: 'agent', description: 'agent name')
    }

  agent { label params.agent }

  tools {
      dotnetsdk "dotnet"
    }


  stages {

    stage('Cloning Git') {
      steps {
         ws(params.src){
          git credentialsId: '*********************************', branch: params.branch, url: params.url
        }
      }
    }
     
    stage('Building') {
      steps {
          ws(params.src){
            sh 'export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1'
            dotnetBuild project: './server/server.sln'
          }
        }
    }   
  }
}

尽管有所有这些,它仍然会抛出此错误消息:

[workspace] $ /home/jenkins/agent/tools/io.jenkins.plugins.dotnet.DotNetSDK/dotnet/dotnet build ./server/server.sln
Process terminated. 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.
   at System.Environment.FailFast(System.String)
   at System.Globalization.GlobalizationMode.GetGlobalizationInvariantMode()
   at System.Globalization.GlobalizationMode..cctor()
   at System.Globalization.CultureData.CreateCultureWithInvariantData()
   at System.Globalization.CultureData.get_Invariant()
   at System.Globalization.CultureInfo..cctor()
   at System.String.ToLowerInvariant()
   at Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.GetArch()
   at Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment..cctor()
   at Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.GetRuntimeIdentifier()
   at Microsoft.DotNet.Cli.MulticoreJitProfilePathCalculator.CalculateProfileRootPath()
   at Microsoft.DotNet.Cli.MulticoreJitActivator.StartCliProfileOptimization()
   at Microsoft.DotNet.Cli.MulticoreJitActivator.TryActivateMulticoreJit()
   at Microsoft.DotNet.Cli.Program.Main(System.String[])
.NET Command Completed - Exit Code: 134
4

0 回答 0