Installing the latest dotnet-sonarscanner results in a not compatible with net50 error


I am unable to install sonarscanner. I have ran the following cmd: dotnet tool install --global dotnet-sonarscanner

But this results in the following error:
error NU1202: Package dotnet-sonarscanner 5.2.0 is not compatible with net50 (.NETFramework,Version=v5.0) / any. Package dotnet-sonarscanner 5.2.0 supports: error NU1202: - net5.0 (.NETCoreApp,Version=v5.0) / any error NU1202: - netcoreapp2.0 (.NETCoreApp,Version=v2.0) / any error NU1202: - netcoreapp3.0 (.NETCoreApp,Version=v3.0) / any The tool package could not be restored. Tool ‘dotnet-sonarscanner’ failed to install. This failure may have been caused by:
• You are attempting to install a preview release and did not use the --version option to specify the version.
• A package by this name was found, but it was not a .NET tool.
• The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
• You mistyped the name of the tool.

Turned out to be a rouge .NET SDK (5.0.102) which was in C:\Program Files\dotnet\sdk but had no uninstaller associated with it. Removing it from this folder enabled the sonarscanner tool to be installed.

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