P. Paul-Alexandre
P. Paul-Alexandre

Reputation: 189

Difference between MSbuild command line and visual studio on code analysis

I have a Jenkins server where I build and test my code. When I test code analysis with MSBuild on Jenkins server (by command line) I have 87 warnings. And if I test on visual studio, I have 572 warnings.
Which is a huge difference ! After investigation, many of missing warnings are warnings about syntax as CA1704 or CA2204.
I have a ruleset in my solution, and I give the solution path to MSbuild (so it should use this ruleset too, am I right?). So what is missing ? or What I'm doing wrong ?

For information, I use visual studio 2017.

Upvotes: 1

Views: 546

Answers (1)

Apoorva Raju
Apoorva Raju

Reputation: 300

While Executing through MSBuild Command Line we should enable Code Analysis using following command: /p:RunCodeAnalysis:true; and also you should specify the ruleset as CodeAnalysisRuleSet="path to the file"

In VS the codeanalysis could have been enabled in Solution property-->Code Analysis

Upvotes: 1

Related Questions