Sonarqube integration with dotnet framework apps

We are trying to integrate Sonar scan for code coverage for dontnet framework apps via github actions on selfhosted runner, we have documentation for window-latest but not self hosted. Could you please help us on this.

What specific issues are you seeing? What have you tried?

Please include code snippets, minus proprietary information.

1 Like

I have used the below code for sonar scanner but the build output comesup with warning (WARN: Your project contains C# files which cannot be analyzed with the scanner you are using. To analyze C# or VB.NET, you must use the SonarScanner for .NET 5.x or higher, see SonarScanner for .NET | SonarQube Docs)
name: SonarQube CI

on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarqube:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: SonarScanner for .NET 5
uses: SonarSource/sonarqube-scan-action@v1.1.0
with:
# The key of the SonarQube project
sonarProjectKey:
# The name of the SonarQube project
sonarProjectName:
# Optional command arguments to dotnet build
dotnetBuildArguments: src
env:
SONAR_TOKEN:
SONAR_HOST_URL:
LC_ALL: “ru_RU.UTF-8”

I tried to follow the documentation (SonarScanner for .NET | SonarQube Docs) addressed and it worked in my local (as it is windows), but i wanted to convert them to Github actions, but its failing as our Sonar is self-hosted, I would need help for self-hosted runner for sonar integration to our dotnet framework app

What OS are the Github Runners?

it is linux

Could you please help on the above issues on dotnet framework apps

Sorry, I’m not familiar with linux and Sonar. Hopefully others on here can help.

It might be helpful to expand on which implementation and version of linux you are working with.

Hey there.

@Wildcat Thanks for collecting additional information! It really helps.

@Suchetha_Reddy Please do not bump threads, certainly not after 5 hours. Please take time to read our Community FAQ (a nice way of saying, “the rules”").

It looks like you’re trying to use SonarSource/sonarqube-scan-action to analyze .NET code. This isn’t possible, as noted in the action.

In fact, when you create a new project in SonarQube, you should find a tutorial for GitHub Actions + .NET which will tell you how to configure your build.

I can’t quite find out how to access the tutorials for a project that has already been scanned (even if that scan was bogus) other than visiting http://<SONARQUBE_URL>/tutorials?id=<PROJECT_KEY> I’ll raise this point to the relevant team. If you can’t sort out the URL, you can create a new project.