【发布时间】: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
感谢任何帮助。 谢谢
【问题讨论】:
-
确切的错误信息会很有帮助。请参阅:stackoverflow.com/help/how-to-ask 和 stackoverflow.com/help/minimal-reproducible-example 并相应地更新您的问题。
标签: c# .net-core asp.net-core-mvc gitlab-ci