Skip to content

Cannot Run with Only .NET 6 Installed #2906

Description

@mitchelsellers

Describe the bug
Attempting to run this in a project using GitHub actions with ONLY .NET 6 installed results in an error.

Expected Behavior

Expected support to work with .NET 6, without installing additional frameworks.

Actual Behavior

The following error is displayed

Run gittools/actions/gitversion/execute@v0.9.7
Command: dotnet-gitversion /home/runner/work/icg-website/icg-website /output json /output buildserver /config GitVersion.yml
/home/runner/.dotnet/tools/dotnet-gitversion /home/runner/work/icg-website/icg-website /output json /output buildserver /config GitVersion.yml
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '5.0.0' (x64) was not found.
  - The following frameworks were found:
      6.0.0 at [/home/runner/.dotnet/shared/Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

Possible Fix

Installation of .NET 5 in addition to 6 works, but adds to build times etc.

Steps to Reproduce

Run the commend on a machine with only .NET 6 installed. As example, the following is the first part of our GitHub action that generated the above.

name: CI/CD

on:
  push:
    branches: [ develop ]
  pull_request:
    branches: [ develop ]
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    name: Build and Publish

    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: 0

    - name: Ensure .NET Installed
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: 6.0.x
        
    - name: Install EF Tools
      run: dotnet tool install --global dotnet-ef
    
    - name: Install GitVersion
      run: dotnet tool install --global GitVersion.Tool

    - name: Determine Version
      id: gitversion
      uses: gittools/actions/gitversion/execute@v0.9.7
      with:
        useConfigFile: true 

Context

This blocks our transition of all .NET projects from upgrading to .NET 6, as the added runtime and "temporary" change of the workaround makes an upgrade not feasible.

Your Environment

GitHub Actions environment, I've added the CI pipeline above

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions