Gitversion: [Bug] GitVersion.Tool in Docker with Net5.0 on Debian Buster Linux fails with "It was not possible to find any compatible framework version"

Created on 24 Nov 2020  路  7Comments  路  Source: GitTools/GitVersion

Describe the bug
In our build Docker image, the following error occurs:

$ touch version.txt
$ dotnet-gitversion /output json /showvariable SemVer > version.txt
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '3.1.0' was not found.
  - The following frameworks were found:
      5.0.0 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
  - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.0&arch=x64&rid=debian.10-x64
ERROR: Job failed: exit code 1

Expected Behavior

Build should work properly and find the framework.

Actual Behavior

Build fails with the error.

Possible Fix

No idea, is Net5.0 even supported yet?

Steps to Reproduce

We have the following Docker build image:

FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim
LABEL author="SeppPenner"
RUN dotnet tool install -g GitVersion.Tool && \
apt-get update && \
apt-get install -y --no-install-recommends gnupg curl ca-certificates apt-transport-https && \
curl -sSfL https://apt.octopus.com/public.key | apt-key add - && \
sh -c "echo deb https://apt.octopus.com/ stable main > /etc/apt/sources.list.d/octopus.com.list" && \
apt-get update && \
apt-get install octopuscli -y
ENV PATH="$PATH:/root/.dotnet/tools" 

This image is executed in our Gitlab build server like this:

variables:
    PROJECT_NAME: "SomeSoftware"
    BUILD_IMAGE: "SeppPenner/dotnetsdk:5.0-buster-slim"
    VERSION: "0.0.0"
    OBJECTS_DIRECTORY: 'obj'
    NUGET_PACKAGES_DIRECTORY: '.nuget'
    SOURCE_CODE_PATH: 'src/'

stages:
  - build

default:
  before_script:
    - touch version.txt
    - dotnet-gitversion /output json /showvariable SemVer > version.txt
    - export VERSION=`cat version.txt`
    - echo "Before script sets VERSION -> $VERSION"

build-default:
  stage: build
  image: $BUILD_IMAGE
  only:
    - master
  script:  
    - echo "Building $VERSION"
    # SomeSoftware
    - cd src/SomeSoftware
    - dotnet restore --configfile ../../NuGet.Config
    - dotnet build --configuration Release -r win10-x64 --output publish/ 
    - cd ..
    - dotnet nuget push **/*.nupkg -s http://customserver.com:5000/v3/index.json -k password
  artifacts:
    paths:
      - src/SomeSoftware/publish/*
  tags:
    - docker

Please note that I replaced the actual names and passwords, of course, so this will not work initially.

Our NuGet.Config file contains some custom nuget sources we use internally.

Context

We are running this in Gitlab build server and with NetCore3.1 it worked (Same Docker image, except that it was the FROM mcr.microsoft.com/dotnet/sdk:3.0-buster base image in Docker).

Your Environment

  • Docker, mcr.microsoft.com/dotnet/sdk:5.0-buster-slim as base image.
  • Gitlab server on CentOs (I believe), latest version.
  • TargetFramework: net5.0 only.
  • The project is a custom nuget package and only references GitVersionTask Version="5.5.1" as dependency, so there is no reference using NetCore3.1 in my project directly.
bug

Most helpful comment

All 7 comments

@SeppPenner currently we have no .net 5.0 support and we also have dependency on Libgit2Sharp that is not working with latest debian.

@arturcic Ah okay, thank you for the information. I assume, that this is a feature request than :)

@SeppPenner I use the following workaround in gitfool/Cake.Dungeon/.gitlab-ci.yml:

# Workaround missing GitVersion native dependency
dotnet tool install GitVersion.Tool --tool-path tools --version 5.5.0
export LD_LIBRARY_PATH=$(pwd)/tools/.store/gitversion.tool/5.5.0/gitversion.tool/5.5.0/tools/netcoreapp3.1/any/runtimes/debian.9-x64/native/

.NET 5 compatibility is being worked on in #2452. For Debian 10 support in LibGit2Sharp, see libgit2/libgit2sharp#1725.

@SeppPenner I use the following workaround in gitfool/Cake.Dungeon/.gitlab-ci.yml:

# Workaround missing GitVersion native dependency
dotnet tool install GitVersion.Tool --tool-path tools --version 5.5.0
export LD_LIBRARY_PATH=$(pwd)/tools/.store/gitversion.tool/5.5.0/gitversion.tool/5.5.0/tools/netcoreapp3.1/any/runtimes/debian.9-x64/native/

This might be worth a try. I have no real struggle to wait a bit to switch to Net5.0, but might be an idea for now :)

@arturcic Thank you for the update. I will test it and come back to you if it doesn't work as expected :)

Was this page helpful?
0 / 5 - 0 ratings