Package dotnet-sonarscanner 5.8.0 is not compatible with net60 (.NETFramework,Version=v6.0)

When our CI performing following command under dotnet 6:

dotnet tool update dotnet-sonarscanner …

It fails and saying the sonarscanner is not compatible with dotnet 6 (LTS) but requiring net5.0 which is already end of life

16:36:21 /tmp/isdo0ki4.x3r/restore.csproj : error NU1202: Package dotnet-sonarscanner 5.8.0 is not compatible with net60 (.NETFramework,Version=v6.0) / any. Package dotnet-sonarscanner 5.8.0 supports:
16:36:21 /tmp/isdo0ki4.x3r/restore.csproj : error NU1202:   - net5.0 (.NETCoreApp,Version=v5.0) / any
16:36:21 /tmp/isdo0ki4.x3r/restore.csproj : error NU1202:   - netcoreapp2.0 (.NETCoreApp,Version=v2.0) / any
16:36:21 /tmp/isdo0ki4.x3r/restore.csproj : error NU1202:   - netcoreapp3.0 (.NETCoreApp,Version=v3.0) / any
16:36:21 Tool 'dotnet-sonarscanner' failed to update due to the following:
16:36:21 The tool package could not be restored.
16:36:21 Tool 'dotnet-sonarscanner' failed to install. This failure may have been caused by:
16:36:21 
16:36:21 * You are attempting to install a preview release and did not use the --version option to specify the version.
16:36:21 * A package by this name was found, but it was not a .NET tool.
16:36:21 * The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
16:36:21 * You mistyped the name of the tool.
16:36:21 
16:36:21 For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool

Hello @png,

Can you please give me more details about how do you run the update command?
I tried running the

dotnet tool update dotnet-sonarscanner --global

command on a VM where only .NET6 was installed and it worked fine.

All the best,
Čaba

Hello

Thanks for your reply, and sorry that I missed some important details which I should have provided
It fails only on our linux CI but works in Windows
and I have missed the tool-path argument in our command

dotnet tool update dotnet-sonarscanner --add-source ****** --tool-path /mnt/jenkins/workspace/*******/dotnet/tools

Hello @png!

I tried running the same command dotnet tool update dotnet-sonarscanner --add-source https://api.nuget.org/v3/index.json --tool-path .\tools, and it also works for me.

I have some remarks/questions regarding the logs from your original post:

  • 16:36:21 /tmp/isdo0ki4.x3r/restore.csproj : error NU1202: Package dotnet-sonar scanner 5.8.0 is not compatible with net60 (.NETFramework,Version=v6.0) / any. Package dotnet-sonar scanner 5.8.0 supports:.
    net60 seems like a wrong TFM - from here - the TFM for .NET6 is net6.0 (with a dot).

  • On the same log line: I’m unsure which project is /tmp/isdo0ki4.x3r/restore.csproj and where it comes from. Is this maybe related to something in your workspace? It shouldn’t be the case - but this does not seem to be something related to the scanner.

  • I see you also provide a nuget feed with --add-source ******. Is it possible the feed you are providing does not have the scanner nuget? Or maybe there’s a package with the same name, and you are pulling that one?

Best Regards,
Mary

Indeed it is very suspicious about .NETFramework,Version=v6.0, it should be some problem in the box setup, thanks for pointing out that

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