We execute following steps in our AzureDevops pipeline in sequence.
Prepare Analysis
dotnet build
dotnet test
dotnet publish
Run Code Analysis
Our observation is that all the three dotnet build/test/publish commands are executing code analysis. This is not the case when we use MSBuild for full .net framework based solutions.
What are we missing here?
sorry for the delay. we’d need the logs to see what’s wrong.
please give us the verbose output of the command (please run add sonar.verbose=true to the Prepare Analysis step extra properties, and please attach the output of the Prepare Analysis and Run Code Analysis steps)
please give us the verbose msbuild/dotnet build logs msbuild /v:d
That is the expected behaviour. As described in the MS docs, both dotnet test and dotnet publish compile the application. The analysis is done as part of the compilation, so the code analysis is performed each time too.
Both dotnet test and dotnet publish have a --no-build option to skip the compilation.