Linux环境下.NET Core GitHub构建管道无变更却失败
Linux环境GitHub构建管道.NET 3.1测试失败,Windows/Mac正常
我修改代码后,Linux环境的GitHub构建管道失效,但Windows和Mac环境的构建可正常完成。已回滚所有代码变更,仅保留注释,与上次成功的Pull Request相比无实质改动,现在构建报错提示You must install or update .NET to run this application.
错误日志
Build started 11/20/2022 12:32:08. 1>Project "/home/runner/work/isoxml-dotnet/isoxml-dotnet/isoxml_dotnet.sln" on node 1 (VSTest target(s)). 1>ValidateSolutionConfiguration: Building solution configuration "Debug|Any CPU". Test run for /home/runner/work/isoxml-dotnet/isoxml-dotnet/{package}/bin/Debug/netcoreapp3.1/{package}.dll (.NETCoreApp,Version=v3.1) Microsoft (R) Test Execution Command Line Tool Version 17.3.1 (x64) Copyright (c) Microsoft Corporation. All rights reserved. Starting test execution, please wait... A total of 1 test files matched the specified pattern. Testhost process for source(s) '/home/runner/work/isoxml-dotnet/isoxml-dotnet/{package}.Test/bin/Debug/netcoreapp3.1/{package}.Test.dll' exited with error: You must install or update .NET to run this application. App: /home/runner/.nuget/packages/microsoft.testplatform.testhost/16.9.4/lib/netcoreapp2.1/testhost.dll Architecture: x64 Framework: 'Microsoft.NETCore.App', version '3.1.0' (x64) .NET location: /usr/share/dotnet/ The following frameworks were found: 6.0.10 at [/usr/share/dotnet/shared/Microsoft.NETCore.App] Learn about framework resolution: https://aka.ms/dotnet/app-launch-failed To install missing framework, download: https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.0&arch=x64&rid=ubuntu.22.04-x64 . Please check the diagnostic logs for more information. Test Run Aborted. 1>Done Building Project "/home/runner/work/isoxml-dotnet/isoxml-dotnet/isoxml_dotnet.sln" (VSTest target(s)) -- FAILED. Build FAILED. 0 Warning(s) 0 Error(s)
GitHub Actions构建管道配置
name: .NET on: push: branches: [ "main" ] pull_request: branches: [ "main" ] jobs: buildLinux: runs-on: ubuntu-latest strategy: matrix: dotnet-version: ['3.0', '3.1.x', '5.0.x','6.0.x' ] steps: - uses: actions/checkout@v3 - name: Setup .NET uses: actions/setup-dotnet@v2 - name: Restore dependencies run: dotnet restore - name: Build Linux run: dotnet build --no-restore - name: Test run: dotnet test --no-build --verbosity normal buildWindows: runs-on: windows-latest strategy: matrix: dotnet-version: ['3.0', '3.1.x', '5.0.x','6.0.x' ] steps: - uses: actions/checkout@v3 - name: Setup .NET uses: actions/setup-dotnet@v2 - name: Restore dependencies run: dotnet restore - name: Build Windows run: dotnet build --no-restore - name: Test run: dotnet test --no-build --verbosity normal buildMac: runs-on: macos-latest strategy: matrix: dotnet-version: ['3.0', '3.1.x', '5.0.x','6.0.x' ] steps: - uses: actions/checkout@v3 - name: Setup .NET uses: actions/setup-dotnet@v2 - name: Restore dependencies run: dotnet restore - name: Build Mac run: dotnet build --no-restore - name: Test run: dotnet test --no-build --verbosity normal
注:dotnet.yml配置文件未做任何修改
已尝试的解决方法
- 回滚所有代码变更,仅保留注释
- 修改
actions/setup-dotnet版本为v3、v3.0.2、v2.0.1,但问题仍未解决
内容的提问来源于stack exchange,提问作者Human_BetaRelease
相关产品推荐
相关产品推荐

