Gitlab-ci.yml template for MS VS C#.NET Framework project

Dear Sonar Community,

I’ve been trying to set up the very first time my GitLab project to run analysis on my C#.NET Framework project (created in Microsoft Visual Studio) using SonarCloud.

Which template can I use?

When I’ve tried with the default settings (acquired from the 3-steps-wizard), I’ve got an error message saying: this is an MS build and I need a specific scanner.
And somewhere here I got lost between the templates and different commands using MSBuild, because they are written sometimes for SonarQube and not SonarCloud, see:

SonarScanner.MSBuild.exe begin /k:"project-key" 
MSBuild.exe <path to solution.sln> /t:Rebuild
SonarScanner.MSBuild.exe end 

Hi @Gabor and welcome to the community !

Yes we’re lacking of a proper tutorial on GitLab for .NET project, we will be adding that in the future.

In the mean time, you can use the dotnet global tool (See our doc : https://sonarcloud.io/documentation/analysis/scan/sonarscanner-for-msbuild/) i don’t think that you can use Windows executable in a GitLab CI environement, except if you can run a windows-based docker image.

HTH,
Mickaël

1 Like

Hi @mickaelcaro
Thank you for the support, I’ll have a look at the link : )

1 Like