GitLab Code Quality job throws 'dotnet not found'

457 Views Asked by At

I'm trying to perform Code Quality test using GitLab CQ tool applying to my .NET 7 project. I'm a quite new it this, so, firstly I added default trigger to my .gitlab-ci.yml for getting this job running

include:
  - template: Code-Quality.gitlab-ci.yml

and got the error

/bin/sh: eval: line 140: dotnet: not found

enter image description here

After that, I've tried to change the image, used by CQ tool, because I think the error occurs as CQ image has not dotnet installed

code_quality:
  variables:
    CODE_QUALITY_IMAGE: "mcr.microsoft.com/dotnet/sdk:7.0"

but this didn't solve the problem - I'm still getting the same error. I googled a lot and didn't find any helpful highlights.

So, what is the correct configuration of .gitlab-ci.yml for .NET projects with Code Quality enabled?

1

There are 1 best solutions below

3
Ali Safari On

As you report that the GitLab runner is unable to find the .NET command-line tool "dotnet", then you may need to install the .NET SDK first (on the machine that's running the GitLab runner.).

You can download and install the .NET SDK from Microsoft's website: here.

Then, try running your GitLab CI pipeline again to see if the error has been resolved.