This is with Sonar Community v24.12.0.100206
using dotnet-framework-sonarscanner 9.2.0 (We have to use .Net Framework 4.8)
Using the /d:sonar.verbose=true argument, we are getting the error:
Downloading from ``https://server-name/api/settings/values?component=unknown``... Unable to connect to server.
and a 403 is given.
However the command line for the sonar scanner does have the component key and name in it, so I don’t see why ‘unknown’ is being used.
I suspect our actual problem is something with our ‘no proxy’ settings, but if that’s the case, why does the component=unknown get used when both the name and key are being set?
Thank you for reporting this and welcome to the Community!
The component=unknown value is misleading, but it does not mean the project key or name was ignored. It is used during the scanner’s early settings request; when that request receives a 403, the scanner cannot complete the normal project-resolution flow and reports the generic connection/authentication error.
Based on the behavior described, we recommend checking the proxy configuration on the build machine. In particular, the .NET Framework variant of SonarScanner for .NET does not use HTTP_PROXY, HTTPS_PROXY, or NO_PROXY environment variables. If a proxy is required, please configure it through SONAR_SCANNER_OPTS, for example:
set SONAR_SCANNER_OPTS=-Dhttp.proxyHost=yourProxyHost -Dhttp.proxyPort=yourProxyPort -Dhttp.nonProxyHosts=yourSonarServer
Please also confirm whether the request reaches the SonarQube server by checking the reverse-proxy and SonarQube access logs for the failing /api/settings/values?component=unknown request. This will help distinguish a proxy/network issue from a genuine authorization failure.
Finally, both components are out of date: SonarScanner for .NET 9.2 is deprecated, and your SonarQube Community Build 24.12.0.100206 is no longer current. The latest Community Build release is 26.7.0.124771. Once the immediate issue is resolved, we recommend planning upgrades for both the scanner and Community Build.
I haven’t seen any Sonar Scanner for DotNet Framework that is newer than 9.2.
Our project works with Microsoft Office VSTO which is on .Net Framework 4.8, so we can’t move to the latest .Net Scanners since they don’t support the older Framework.
The SonarScanner for .NET ships a dedicated .NET Framework 4.6.2+ build with every release, which fully covers your .NET Framework 4.8 VSTO project.
The current version is 11.2.0.135473, and the .NET Framework build is available directly on the Prerequisites page.
Note, the docs explicitly state that version 9.2 has been deprecated and should not be used. Upgrading to 11.2 is strongly recommended regardless of the proxy issue, there have been meaningful improvements to proxy handling, JRE management, and connection error messaging in the intervening versions that may also address the misleading component=unknown error you reported.
The error you’re seeing is related to the installation method, not the scanner itself. The dotnet tool install command requires a .NET (Core) runtime, so it will fail on a .NET Framework 4.8 machine, this is a .NET CLI constraint.
SonarScanner for .NET 11.x does include a dedicated .NET Framework 4.6.2+ build, but it is distributed as a standalone zip, not via dotnet tool install. To use it:
In fact, there is even an easier way that you mention. The dotnet install command does work in my case. The scanner can use the latest .Net, it doesn’t need to match what the project itself is using.
I do have to remove the project reference to the old scanner, but that is simple and its no longer needed anyways.