Closed tom-howlett-sonarsource closed 2 years ago
Maybe you just want to create a build for .NET 6 and investigate afterward... This blocks our adoption of .NET 6 :) You can just specify multiple targets. This is what we do for our global tools.
Hi @msallin
Sorry hear that. To help me understand the 'why', can you let me know where your build agent is running? Why would it not be possible or desirable to also have .NET 5 installed?
Thanks
Tom
We run our builds on Jenkins. For this, we do xcopy "install" of the SDK. And our pipeline is built to be able to just have one SDK. To have multiple, we have to do an xcopy/merge "install" which is pain. Hence, we always just use the latest SDK. Our own global tools just target multiple frameworks.
Maybe you just want to create a build for .NET 6 and investigate afterward... This blocks our adoption of .NET 6 :) You can just specify multiple targets. This is what we do for our global tools.
Agreed, the sooner we can get a .NET 6 build, the better
This is the error I get attempting to run a scan on a .NET 6 projects on a GitHub Actions runner (ubuntu-20.04):
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '5.0.0' (x64) was not found.
- The following frameworks were found:
6.0.0 at [/home/runner/.dotnet/shared/Microsoft.NETCore.App]
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
- https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=5.0.0&arch=x64&rid=ubuntu.20.04-x64
That's a bit confusing to me, because according to GitHub that runner already has (multiple!) .NET 5 SDKs installed: https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md#net-core-sdk
Hi @IGx89
Thanks for reporting this. Although the Github Action Runner has multiple SDKs installed, when we include:
- name: Setup .NET 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
It disables the other .NET versions
We will get a .NET 6 compatible scanner out as soon as we can, in the meantime there is a workaround you can use by switching between .NET 5 & 6 at the appropriate points. I've created an example of this here ``
An alternative workaround to try would be to execute the scanner as follows:
dotnet --roll-forward LatestMajor sonarscanner.msbuild.dll ...
See the MS docs for more information.
That's a great idea, thanks! Adding the following to the SonarScanner Begin/End steps caused it to work:
env:
DOTNET_ROLL_FORWARD: Major
Unfortunately however, it's no longer reporting LOC/issues for a lot of the *.cs files (Blazor webapp). Still better than turning off scanning completely at least.
Unfortunately however, it's no longer reporting LOC/issues for a lot of the *.cs files (Blazor webapp). Still better than turning off scanning completely at least.
Hello @IGx89. Would it be possible to provide a reproducer for this problem?
Unfortunately however, it's no longer reporting LOC/issues for a lot of the *.cs files (Blazor webapp). Still better than turning off scanning completely at least.
Hello @IGx89. Would it be possible to provide a reproducer for this problem?
You actually sort of already provided one yourself -- just take https://github.com/andrei-epure-sonarsource/aspnet5mvc-reproducer and change the csproj TFM from net5.0
to net6.0
. LOC was present for the former but disappeared when I changed to the latter.
Thanks @IGx89 , I confirm the regression on ASP .NET 6 MVC projects. Opened #1116.
Does latest version of Sonar Scanner supports .NET6 API projects , In docs it says it supports the .NET6 Web Projects only. if not can i know which version of Sonarscanner supports .NET6 API Projects
@balajigv-mcd we explicitly mention .NET Web Projects because they have a new compilation mechanism for Razor files.
Yes .NET 6 API Projects are supported as well.
(cc @tom-howlett-sonarsource )
Hi. I'm facing same problem with .NET 6 + GitLab CI. + SonarCloud
I'm a bit confused because everyone talk about install SDK or use some version of .net. But when I setted up my account and import the project from my GitLab account the suggested job just call the binary sonar-scanner
that's all. We are using the docker image sonarsource/sonar-scanner-cli:latest
Where should I specify the framework version? or where to passing parameters to any dotnet build or dotnet test?
This is my Job which was proposed by SonarCloud wizard:
sonarcloud-sast-qa: image: name: sonarsource/sonar-scanner-cli:latest entrypoint: [""] stage: test variables: SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task cache: key: "${CI_JOB_NAME}" paths: - .sonar/cache script: - sonar-scanner
Hi @dacardona, this repository is not related to sonar-scanner-cli
. Please post your question on your https://community.sonarsource.com/
The Scanner currently requires an SDK that matches the major and minor version of the scanner build. We would like to allow users to run the scanner on agents with only .NET 6 SDK to match our policy of allowing the scanner to run where the code is built without additional installs.
The goal of this ticket is to: