Install Free
Visual Studio | Team features | Connected Mode setup

Connected Mode setup

On this page

Connection setup

SonarLint for Visual Studio provides a connection wizard to help you set up Connected mode with SonarQube (Server, Cloud) or SonarQube Community Build. From version 7.4, you can share a setup configuration file with your team, simplifying the process. 

Automatic setup

SonarQube Server 10.4+ and SonarQube Community Build offer the easiest way to set up connected mode: simply use the Open in IDE feature from SonarQube Server SonarQube Community Build. You must trust the server to store a token for the connection, and it's best if you already have the project open in your IDE. 

If something doesn’t work, check the Troubleshooting article, or follow the instructions below to manually create a SonarQube connection.

Create a new SonarQube Connection

Open the SonarLint Manage Project Binding wizard in Visual Studio by navigating to Extensions > SonarQube for Visual Studio > Connected Mode > Bind to SonarQube (Server, Cloud)…. The current Binding Status will be shown. Next, select Manage connections to open a list of your Existing Connections and choose New Connection to create a new connection.

Choose SonarQube Server as your connection type, enter your SonarQube Server URL, and select Next to continue. The server URL is the same if you're using SonarQube Community Build.

Add the SonarQube Server details to set up your connection with SonarQube for Visual Studio.

You have the option to select your Authentication type; please note that using Credentials is deprecated and authenticating with a Token is recommended.

  • To generate a new user token, navigate to User > My Account > Security in SonarQube Server or simply use the Generate hyperlink to open the page in SonarQube Server, which will use the URL you provided earlier.

The final steps involve binding your local project to the project on the server. See below for more details.

Automatic setup

SonarQube Cloud offers the easiest way to set up connected mode: simply use the Open in IDE feature from SonarQube Cloud. You must trust the SonarQube Cloud server to store a token for the connection, and it's best if you already have the project open in your IDE. 

If something doesn’t work, check the Troubleshooting article, or follow the instructions below to manually create a SonarQube Cloud connection.

Create a new SonarQube Cloud Connection

Open the SonarLint Manage Project Binding wizard in Visual Studio by navigating to Extensions > SonarQube for Visual Studio > Connected Mode > Bind to SonarQube (Server, Cloud)…. The current Binding Status will be shown. Next, select Manage connections to open a list of your Existing Connections and choose New Connection to create a new connection.

Choose SonarCloud as your connection type and select Next to continue. 

Select SonarQube Cloud to set up your connection with SonarQube for Visual Studio.

You have the option to select your Authentication type; please note that Credentials is deprecated and authenticating with a Token is recommended.

  • To generate a new user token, navigate to User > My Account > Security in SonarCloud or use the Generate hyperlink to open this page on SonarCloud.

Then, choose one of your organizations from the list, and select OK. If you don’t see the organization you want in this list, select Choose another organization and manually enter its organization key.

The final steps involve binding your local project to the project on the server. See below for more details.


First-time connection setup for shared binding

One team member must step through the first-time setup process, then export and commit the binding configuration to the repository. Any team member who opens the project while running SonarQube for IDE will automatically receive a notification to bind the project. Each team member must use their own project credentials and SonarQube for IDE will use the binding details found in the configuration file to complete the connection.

To begin, one person from the team must follow the steps outlined in Using the connection wizard and Configure your binding, then follow the Save and share your setup instructions below to save the project configuration for the rest of the team. 

Using the connection wizard

Connected Mode

Follow the Connection setup instructions above for your SonarQube (Server, Cloud) or SonarQube Community Build connection.

Configure your binding

Bind your project

After creating a connection and with the Manage Project Binding wizard open, choose your Connection to bind to define the server and select the Select project button to define the Project to bind. The Select project button will open a list of your projects on the server. 

Choose the project you want to bind, select the Select button, and select Bind.

You will receive a confirmation if the binding is a success. 

For Tfvc users

Additional notes for Tfvc users

If you are using Team Foundation Version Control and have C# or VB.NET projects in your solution, it is possible that you will see some additional dialogs from Tfvc appearing when binding finishes. If your solution does not contain C# or VB.NET projects, you can disregard the rest of this section.

Tfvc might pop up one or more dialogs like the one below warning that files outside the workspace are being referenced and asking for confirmation that this is ok. These files are used to configure analysis for C# and VB.NET, and do not need to be under source control. Select Add the item to dismiss the dialog.

Select Add the item to close out the Tfvc pop-ups. They will not appear again.

Once you have dismissed the Tfvc dialogs, they should not appear again.

Save and share your setup: Recommended for teams

Save the connection binding

After completing the steps outlined in the Using the connection wizard section above, go to Visual Studio Extensions > SonarQube for VIsual Studio > Connected Mode and select Export Binding Configuration

A .json file will be added to your .sonarlint folder containing the SonarQube URI & Project Key, or SonarQube Cloud Organization & Project Key. 

Share the connection binding

Commit the file you just created in the working directory; your teammates should have access to the binding configuration once your commit becomes part of the repository.

Because your Project’s identifying information is saved in a location under source control, it will be available to anyone with access to the project repo. Each team member is still required to have their own SonarQube Server or SonarQube Cloud credentials; these are managed in SonarQube Server and SonarQube Cloud, respectively.

Each team member is still required to have their own SonarQube Server or SonarQube Cloud connection and credentials.

Bind using shared configuration

Once the shared project configuration has been saved by one team member, additional team members will have a streamlined process when configuring their project binding. To achieve this, SonarQube for VIsual Studio automatically looks for the .sonarlint folder; if it’s available and the shared configuration file is there, SonarQube for VIsual Studio will offer you a gold bar to streamline the setup. 

Use the SonarLint for Visual Studio configuration gold bar to help streamline the binding process.

Select the Bind option from the gold bar to continue setting up your connection to the server using the shared settings. If you already have a connection to the correct server, the binding will start automatically. 

If you don’t already have a connection, you will receive a notification. In this case, select OK on the notification and select Manage connections from the Manage Project Binding wizard to manually create a connection. In the Manage connections window, step through the connection setup by selecting either SonarQube or SonarCloud to add your user token, as it is described above in Connection setup.

If you wish to opt out of using the shared connection settings and select Don’t show this again, the gold bar will no longer appear. To accept a shared configuration, select the Use Shared Configuration option from the Manage Project Binding window.

Sharing configurations between different IDEs

SonarQube for IDE extensions are available for IntelliJ (and other Jet Brains IDEs), Visual Studio, VS Code, and Eclipse. Although the information stored in the shared configuration file is the same, each extension might export the JSON file to a slightly different location depending on IDE and project type. This may cause friction when opening a configuration in an IDE other than the IDE that created it.

If SonarQube for IDE does not send you a notification to accept a shared configuration, please check first if you have opened your project’s root. If SonarQube for IDE still does not suggest a matching configuration, you must configure binding manually. Please see the Configure your binding collapsible above for instructions.

SonarQube for Visual Studio does not support generic connections. The file name of the shared configuration JSON file must match the currently opened solution name when binding a solution, or the currently opened folder name when binding a folder (for example, in a CMake project).

Project binding

When you bind a project, SonarQube for Visual Studio uses the quality profile defined on the server to decide which rules to run locally and which rule parameters to use. When you mark a particular issue as “safe” or “won’t fix” on the server, the corresponding issue will be ignored in the IDE. Check the SonarQube Servere or SonarQube Cloud documentation for details about managing your quality profile.

Synchronization with the server

The local connected mode configuration files can sometimes get out of step with settings on the SonarQube (Server, Cloud) or SonarQube Community Build servers for example, when a quality profile for the project is changed (on the server).

Synchronization between SonarQube Server and SonarQube for Visual Studio is almost instantaneous. For example, when changes are made to the quality profile, SonarQube Server sends SonarQube for Visual Studio an event notice; with SonarQube Cloud, SonarQube for Visual Studio checks the SonarQube Cloud server every ten minutes to listen for changes.

Unbinding a project

To unbind a SonarQube Server or SonarQube Cloud project, delete the bindings folder associated with your project. 

Each bound solution will have a unique folder in the %AppData%\Roaming\SonarLint for Visual Studio\Bindings folder; delete the correct project folder to remove the binding.

Updating your credentials

From SonarLint for Visual Studio version 8.7, you can edit your authentication details in the SonarQube for Visual Studio UI.

Open the SonarLint Manage Project Binding wizard (Extensions > SonarQube For Visual Studio > Connected Mode > Bind to SonarQube or SonarCloud…), and select Manage connections. There, you can select the pencil to edit your connection.

Use the Manage Connections window to edit your SonarQube (Server, Cloud) connection setup.

Legacy Connected Mode

Before SonarLint for Visual Studio version 7.0 (released in June 2023), connected mode behaved a bit differently. Please see the Previous versions page for the important details. 

In addition, the process of setting up connected mode in versions 8.3 and earlier looks a bit different; all of this content was moved to the Legacy connected mode article on the Previous versions page.


Was this page helpful?

© 2008-2024 SonarSource SA. All rights reserved. SONAR, SONARSOURCE, SONARQUBE, and CLEAN AS YOU CODE are trademarks of SonarSource SA.

Creative Commons License