skip to Main Content

I tried to add changes to my code and the build pipeline for Linux stopped working. The ones for Windows and Mac succeed.

I reverted all changes, so there are no changes except for comments since the last PullRequest which succeeded.

Now it fails with the following message: (Short: "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)

My Build Pipeline looks like this:

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

Please recognize that there are no changes in the dotnet.yml

What I tried so far:

  • Revert all changes; everything left is just comments
  • Change version of actions/setup-dotnet to v3, v3.0.2, v2.0.1

Remark on Edit: I removed the PackageName with {package} as it’s not relevant for the solution. Hope that’s OK 😉

2

Answers


  1. Your Azure Pipelines YAML calls the setup-dotnet action, but won’t actually pass it a version to. That will just select the default version on the OS image.

    Make sure you pass your matrix variable:

    - uses: actions/setup-dotnet@v3
      with:
        dotnet-version:  ${{ matrix.dotnet-version }}
    

    My guess is they stripped a number of no longer supported dotnet SDKs from the image now that dotnet 7 has been released.

    Login or Signup to reply.
  2. Not a surprise as GitHub is rolling out Ubuntu 22.04 as ubuntu-latest between Oct 3 and Dec 1, 2022,

    https://github.com/actions/runner-images/issues/6399

    It seems that your workflow is somehow enrolled.

    If you take a look at the contents of Ubuntu 22.04 image, you can see that .NET Core 3.1 runtime is not there,

    https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md

    .NET Core 3.1 is going to reach end of life in just a few days, so please upgrade your projects to .NET 6 at least. It simply makes no sense to target old runtimes.

    If you do want to set up old runtimes you might use,

        - name: Setup .NET Core
          uses: actions/setup-dotnet@v1
          with:
            dotnet-version: |
              3.1.x
              5.0.x
              6.0.x
    

    https://github.com/lextudio/sharpsnmplib/blob/12.5.1/.github/workflows/dotnetcore.yml#L28

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search