Visual Studio 2015 Code Analysis vs FxCopCmd.exe difference
Asked Answered
S

1

6

I recently installed Visual Sudio 2015 and was able to run code analysis for the solution with the following command:

msbuild.exe MySolution.sln /p:RunCodeAnalysis=true

where /p:RunCodeAnalysis=true performs the code analysis. Actually this calls the FxCopCmd.exe located in

C:\Program Files(x86)\Microsoft Visual Studio 14.0\Team Tools\Static AnalysisTools\FxCop\FxCopCmd.exe

Code Analysis was meant to replace FxCop, but actually Code Analysis executes itself FxCopCmd.exe

Maybe I miss something, but what is the difference between VS Code Analysis and FxCop?

Sternson answered 23/11, 2015 at 15:34 Comment(0)
L
11

FxCop and VS Code Analysis are essentially the same thing. They use the same core analysis engine (triggered via fxcopcmd.exe) and ship with the same core set of rules. Besides UI distinctions, the main difference betweeen FxCop and VS Code Analysis is that the latter includes some extra rules (in the DataflowRules.dll, MaintainabilityRules.dll, and ReliabilityRules.dll assemblies), plus a dataflow analysis engine that supports a subset of these additional rules.

Labio answered 23/11, 2015 at 16:36 Comment(3)
That makes sense, but as far as I can see, when I execute for example: msbuild.exe MySolution.sln /p:RunCodeAnalysis=true(which starts also code analysis), this actually starts the C:\Program Files(x86)\Microsoft Visual Studio 14.0\Team Tools\StaticAnalysisTools\FxCop\FxCopCmd.exe command. Is this not the same as executing FxCop directly?Sternson
Not quite sure what you're asking here... MSBuild launches fxcopcmd.exe via a custom MSBuild task, defined in the fxcoptask.dll assembly (which you'll probably find in the C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\CodeAnalysis folder). All this task does is construct a command line for fxcopcmd.exe by translating MSBuild properties into command line switch arguments. You certainly can construct that same command line manually if you so choose.Labio
This was what I wanted to know. So, either we execute code analysis by adding the <RunCodeAnalysis>true</RunCodeAnalysis> to the .csproj file OR execute C:\Program Files(x86)\Microsoft Visual Studio 14.0\Team Tools\Static AnalysisTools\FxCop\FxCopCmd.exe from the command line shall have the same result.Sternson

© 2022 - 2024 — McMap. All rights reserved.