【问题标题】:Build fails on private Gitlab build server在私有 Gitlab 构建服务器上构建失败
【发布时间】:2019-10-11 06:33:43
【问题描述】:

我在本地网络中设置的 gitlab 运行程序有问题。当运行程序开始构建时,它会失败,说它找不到 .Net 核心 SDK,但是当我登录服务器并手动运行命令时,构建成功。

这是我的 gitlab-ci.yml

variables:
  NUGET_PATH: 'C:\Tools\Nuget\nuget.exe'
  MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
stages:
    - build
    - test

build:
    stage: build
    only:
        - branches
    script:
        - 'cd Project'
        - '& "$env:NUGET_PATH" restore'
        - '& "$env:MSBUILD_PATH" /p:Configuration=Release /clp:ErrorsOnly'

    artifacts:
      paths:
        - bin/

test:
    stage: test
    script: 
        - "dotnet test"

这是输出

$ cd Project
$ & "$env:NUGET_PATH" restore
MSBuild auto-detection: using msbuild version '16.3.1.50202' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\bin'.
C:\GitLab-Runner\builds\_edited_\0\_edited_\project\Project\Project\Project.csproj : error : Unable to locate the .NET Core SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.
C:\GitLab-Runner\builds\_edited_\0\_edited_\project\Project\Project\Project.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk.Web' specified could not be found.
  It was not possible to find any installed .NET Core SDKs
  Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:
      https://aka.ms/dotnet-download

ERROR: Job failed: exit status 1

感谢任何帮助。 谢谢

【问题讨论】:

标签: c# .net-core asp.net-core-mvc gitlab-ci


【解决方案1】:

确保运行器以拥有 SDK 或全局安装 SDK 的用户身份运行。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-08
    • 1970-01-01
    • 1970-01-01
    • 2016-02-27
    • 1970-01-01
    • 2014-01-26
    相关资源
    最近更新 更多