How to run analys from Visual Studio 2019

Hi I already have integration with Sonarcloud and Gitlab CI, also I have installed Sonarlint in Visual Studio and SonarQube in Team Explorer.The problem is that I already make these steps

  1. Open the Team Explorer Home tab and click on the SonarQube icon
  2. Click on Connect… to display the connection dialogue
  3. Select the server and enter your credentials
  4. Select the Organization (SonarCloud only)
  5. Select the Sonar project to bind to
  • Right click solution → Analysis → Run Code Analysis
    but I still can preview this new analys in Sonarcloud.Only old from Gitlab Ci are availiable.

Binding a solution to a SonarCloud/SonarQube project does not trigger an analysis. All it does is configure the solution so that the IDE uses the set of rules specified in the Quality Profile of the bound project. See the SLVS wiki for more information.

When analysis is triggered depends on the language being analysed:

  • C/C++/JavaScript: on file open and file save
  • C#/VB.NET: the Sonar C# and VB.NET rules are implemented using the Roslyn framework, so analysis is run automatically in the background by Visual Studio. Depending on your VS settings, either only open documents will be analysed, or all files. See the MS docs for more information.

As discussed in another thread, analysing code in the IDE does not push results to SonarCloud/SonarQube.

The “Run Code Analysis” command is a standard built-in Visual Studio command. Exactly what it does depends on the version of Visual Studio you are using, so you should check the appropriate Microsoft documentation. However, it will only ever run analysis locally on the developer’s machine.