我在 Ubuntu (18.04.4 LTS) 上使用 Github 运行器(以 root 运行)构建了一个 dotnet 项目。构建意外失败(2 次成功运行,然后每次都失败)。直接从命令行运行时,每次都使用相同的构建命令:
dotnet publish --configuration Release ./Gif
我使用 github runner 得到的一致错误:
dotnet publish --configuration Release ./Gif
shell: /bin/bash -e {0}
env:
DOTNET_ROOT: /root/.dotnet
VERSION: 123
Microsoft (R) Build Engine version 16.7.2+b60ddb6f4 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
/root/.dotnet/sdk/3.1.415/NuGet.targets(128,5): error : 'N/A' is not a valid version string. (Parameter 'value') [/home/actions-runner/_work/gif-onboarding/gif-onboarding/Gif/Gif.sln]
Error: Process completed with exit code 1.
构建 yaml 文件:
name: .NET-main
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: self-hosted
steps:
- name: Cleanup
run:
rm -rf ./*
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
- name: Build
env:
VERSION: "123"
run: dotnet publish --configuration Release ./Gif
- name: Deploy
run: |
cp -a ./Gif/GifOnboarding/bin/Release/netcoreapp3.1/* /var/www/dotnet/
我已经尝试过“env:VERSION”参数。在一系列失败之后 - 当我添加 env:VERSION 参数时 - 它成功了两次,然后又回到错误。通过将 env:version 添加/删除到 yaml 文件,我无法再次重现它。
引用的 /3.1.415/NuGet.targets(128,5) 如下所示:
<RestoreTask
RestoreGraphItems="@(_RestoreGraphEntryFiltered)"
RestoreDisableParallel="$(RestoreDisableParallel)"
RestoreNoCache="$(RestoreNoCache)"
RestoreIgnoreFailedSources="$(RestoreIgnoreFailedSources)"
RestoreRecursive="$(RestoreRecursive)"
RestoreForce="$(RestoreForce)"
HideWarningsAndErrors="$(HideWarningsAndErrors)"
Interactive="$(NuGetInteractive)"
RestoreForceEvaluate="$(RestoreForceEvaluate)"
RestorePackagesConfig="$(RestorePackagesConfig)"/>
我该如何进一步解决这个问题?