Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Gitlab CI support Asp.net Core 3.1?

I have the following simple pipeline defined for my Asp.Net Core project:

image: microsoft/dotnet:latest

stages:
    - build
    - test

variables:
    test: "Testing"

before_script:
    - "cd *my folder with projects*"
    - "dotnet restore"

build:
    stage: build
    script:
        - "dotnet build"

test:
    stage: test
    script: 
        - "dotnet test"

When I tried to run it against my project, it failed with an exit code 1 and a message:

/usr/share/dotnet/sdk/2.1.803/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.1.

like image 697
droft1312 Avatar asked Feb 10 '20 17:02

droft1312


1 Answers

Try setting the image to

mcr.microsoft.com/dotnet/core/sdk:3.1

That should use the .NET Core 3.1 SDK

like image 122
Ghonima Avatar answered Oct 01 '22 04:10

Ghonima