I have SonarLint working fine for VisualStudio 2019 when a win32 target is selected and compiling c++ code. I am using SonarLint in its standalone mode (not connected to SonarQube)
However, when attempting to use it with VisualGDB (VisualStudio Marketplace plugin) then the sonar log gives an error message complaining about a lack of PlatformToolset in the vcxproj. This XML key isnt set when using VisualGDB toolchains. Just to note that VisualGDB has its own project properties page and doesnt use the normal visual studio properties page so it is without any options to add the required key. Tried adding it manually, but then get an error appearing to indicate that there are no rules as well as breaking the build process.
The settings.json contains the following (which appears to be the default):
{ “sonarlint.rules”: { } }
I haven’t been able to find any documentation / manual for what should go in the sonarlint.rules json or if VisualGDB flows within VS2019 are supported by SonarLint?
For reference I was using MSbuild and the gcc-arm compilers under VisualGDB. This may be a simple “no” only the MS compiler chain is supported.
To recreate this simply install the (free) VisualGDB plugin from visual studio marketplace and select a gcc-arm toolchain and say the LED flash example project.
Many thanks in advance. Error message and stack-trace below.
Initializing the telemetry package…
Finished initializing the telemetry package…
Initializing the daemon package…
Loaded settings from “C:\Users\zzz\AppData\Roaming\SonarLint for Visual Studio\settings.json”.
Using default daemon download URL
Daemon version: 4.3.2.2521
Daemon download url: https://binaries.sonarsource.com/Distribution/sonarlint-daemon/sonarlint-daemon-4.3.2.2521-windows.zip
Finished initializing the daemon package.
Unable to collect C/C++ configuration for P:\Software\GDBprojects\test11\test11.cpp: System.ArgumentException: The file cannot be analyzed because the platform toolset has not been specified. Set the Platform Toolset property through the Visual Studio project property page.
at SonarLint.VisualStudio.Integration.Vsix.CFamily.CFamilyHelper.FileConfig.GetCompilerVersion(String platformToolset, String vcToolsVersion)
at SonarLint.VisualStudio.Integration.Vsix.CFamily.CFamilyHelper.FileConfig.TryGet(ProjectItem dteProjectItem, String absoluteFilePath)
at SonarLint.VisualStudio.Integration.Vsix.CFamily.CFamilyHelper.TryGetConfig(ILogger logger, ProjectItem projectItem, String absoluteFilePath)
Unable to collect C/C++ configuration for P:\Software\GDBprojects\test11\test11.cpp: System.ArgumentException: The file cannot be analyzed because the platform toolset has not been specified. Set the Platform Toolset property through the Visual Studio project property page.
at SonarLint.VisualStudio.Integration.Vsix.CFamily.CFamilyHelper.FileConfig.GetCompilerVersion(String platformToolset, String vcToolsVersion)
at SonarLint.VisualStudio.Integration.Vsix.CFamily.CFamilyHelper.FileConfig.TryGet(ProjectItem dteProjectItem, String absoluteFilePath)
at SonarLint.VisualStudio.Integration.Vsix.CFamily.CFamilyHelper.TryGetConfig(ILogger logger, ProjectItem projectItem, String absoluteFilePath)
Unable to collect C/C++ configuration for P:\Software\GDBprojects\test11\test11.cpp: System.ArgumentException: The file cannot be analyzed because the platform toolset has not been specified. Set the Platform Toolset property through the Visual Studio project property page.
at SonarLint.VisualStudio.Integration.Vsix.CFamily.CFamilyHelper.FileConfig.GetCompilerVersion(String platformToolset, String vcToolsVersion)
at SonarLint.VisualStudio.Integration.Vsix.CFamily.CFamilyHelper.FileConfig.TryGet(ProjectItem dteProjectItem, String absoluteFilePath)
at SonarLint.VisualStudio.Integration.Vsix.CFamily.CFamilyHelper.TryGetConfig(ILogger logger, ProjectItem projectItem, String absoluteFilePath)
Initializing the notifications package…
Not connected: not checking for notifications
Finished initializing the notifications package