You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VS2019 and the corresponding MSBuild targets now supports project-file properties to control whether NuGet analyzers are executed. See here.
The scanner should override those properties at build time to that analysis always performed, regardless of the properties that are set in the project file.
Note: the SonarQube.Integration.targets already contain a target called SetRoslynCodeAnalysisProperties that sets some of the analysis properties at build time.
User impact: the current behaviour can lead to hard-to-diagnose issues. See this community thread.
TODO
Decide what the user behaviour we actually want in this case.
On the one, if the user has set RunAnalyzers/RunAnalyzersDuringBuild=false, they might expect that the project would be skipped by Sonar analysis too.
On the other hand, if the user has triggered an analysis run using the Scanner for MSBuild, they probably expect everything to be analyzed.
SonarC#/VB.NET analysis rules are executed and metrics are produced.
Actual behavior
The build completes successfully, but the SonarC#/VB.NET analysis rules are not executed and no metrics are produced.
Note: no analysis results are pushed to the server. If the project has not been analysed before then the Sonar UI will say The main branch of this project is empty.
Known workarounds
Don't manually set RunAnalyzers or RunAnalyzerDuringBuild to false.
Related information
MSBuild: v16.3+
SonarScanner for MSBuild version: latest
SonarQube server version: n/a
Languages in your solution: C#, VB.Net
The text was updated successfully, but these errors were encountered:
For what it's worth, we just encountered this issue and the relatively simple work-around was to supply the /p:RunAnalyzers=true argument when running the msbuild command to build the project.
Scenario: We need to speed up local build (by excluding analysis) when a test is executed from VS UI while still keeping the CI and build setup running the analysis.
Let's just override the setting as we do for the other properties. If users don't want the project to be analyzed, they should set SonarQubeExclude=true.
Description
VS2019 and the corresponding MSBuild targets now supports project-file properties to control whether NuGet analyzers are executed. See here.
The scanner should override those properties at build time to that analysis always performed, regardless of the properties that are set in the project file.
Note: the
SonarQube.Integration.targets
already contain a target calledSetRoslynCodeAnalysisProperties
that sets some of the analysis properties at build time.User impact: the current behaviour can lead to hard-to-diagnose issues. See this community thread.
TODO
Decide what the user behaviour we actually want in this case.
On the one, if the user has set
RunAnalyzers
/RunAnalyzersDuringBuild
=false, they might expect that the project would be skipped by Sonar analysis too.On the other hand, if the user has triggered an analysis run using the Scanner for MSBuild, they probably expect everything to be analyzed.
Repro steps
begin
stepExpected behavior
SonarC#/VB.NET analysis rules are executed and metrics are produced.
Actual behavior
The build completes successfully, but the SonarC#/VB.NET analysis rules are not executed and no metrics are produced.
Note: no analysis results are pushed to the server. If the project has not been analysed before then the Sonar UI will say
The main branch of this project is empty.
Known workarounds
Don't manually set
RunAnalyzers
orRunAnalyzerDuringBuild
tofalse
.Related information
The text was updated successfully, but these errors were encountered: