Can I run dotnet sonarscanner without sonarqube instance?

Running sonarlint scanning from VS works fine even if there is no connection between VS and sonarqube instance. So, it seems that the plugin does indeed have some hidden default rules stored somewhere. But is it possible to have the same behavior when running dotnet sonarscanner command. As an example if I say:

dotnet sonarscanner begin /k:“MyProj”

it is still able to run/start the scanning without the need to fetch the rules from sonarqube ?

This way I dont have to have a sonarqube instance running just to fetch those rules.
The reason I need this is because I dont care to publish any result to sonarqube when running the jenkins job. What I need is only to fail the jenkins job if there is any rule violation in my project.

Hi @rey. Welcome to the community.

The whole purpose of the SonarScanner for .NET is to run the analysis and push the results to SonarQube/SonarCloud, so no, you can’t use the scanner without an instance of the server.

However, the Sonar C# and VB.NET analyzers are build using the Roslyn framework and are available as standalone NuGet packages. That means that if you just want to run the Sonar C# (or VB.NET) rules independently as part of your build by referencing their NuGet packages as described in the Microsoft docs.

The NuGet packages ids are SonarAnalyer.CSharp and SonarAnalyzer.VisualBasic.


Hi, thanks for the answer, yep now I think it makes sense :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.