'The framework 'Microsoft.NETCore.App', version '3.1.0' was not found in GitHub Actions

when i push the code to github, and create the file workflow\dotnet.yml.

name: dotnet package

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest
    strategy:
      matrix:
        dotnet-version: ['5.0.x' ]

    steps:
      - uses: actions/checkout@v3
      - name: Setup .NET Core SDK ${{ matrix.dotnet-version }}
        uses: actions/setup-dotnet@v2
        with:
          dotnet-version: ${{ matrix.dotnet-version }}
      - name: Install dependencies
        run: dotnet restore
      - name: Build
        run: dotnet build --configuration Release --no-restore
      - name: Test
        run: dotnet test --no-restore --verbosity normal

In the Actions output, the following error is shown.

The framework 'Microsoft.NETCore.App', version '3.1.0' was not found.
The following frameworks were found: 5.0.17 at [/home/runner/.dotnet/shared/Microsoft.NETCore.App]

Followed the link, and installed the frameworks, but it still errors. Can anyone provide help with this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source