Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run code analysis tool from command line in VS 2015

I want to run the code code analysis tool provided by VS 2015 from the command line the same way I was able to generate FxCop reports, something like this:

FxCopCmd.exe /console /project *Project* /out:*ReportFile*

Note that I don't want to use the FxCop tool, instead I want to launch the code analysis tool to generate a report, similar to what is generated when I select:

Analyze -> Run Code Analysis on Solution

Any idea how that can be accomplished?

UPDATE: After some research, I found out that Running code analysis actually executes the FxCopCmd.exe located in C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\FxCop\FxCopCmd.exe

like image 265
Pinte Dani Avatar asked Nov 19 '15 10:11

Pinte Dani


People also ask

How do I run a Visual Studio code analysis?

In Solution Explorer, select the project. On the Analyze menu, select Run Code Analysis on [Project Name].

How to run ReSharper code analysis?

ReSharper helps you resolve most of the discovered code issues automatically. All you need is to press Alt+Enter when the caret is on a code issue highlighted in the editor and check the suggested quick-fixes.

Where are code analysis results in Visual Studio?

Code analysis will start executing in the background. You should see the message Running code analysis for <project> in the Visual Studio status bar towards the bottom-left corner. Once code analysis completes, the status message will change to Code analysis completed for <project>.

How do I run a command in Visual Studio?

The Command window is used to execute commands or aliases directly in the Visual Studio integrated development environment (IDE). You can execute both menu commands and commands that do not appear on any menu. To display the Command window, choose Other Windows from the View menu, and select Command Window.


1 Answers

Finally I found myself a solution for this.

All I had to do is to add a new Parameter to the MSBuild command:

msbuild MySolution.sln /p:RunCodeAnalysis=true

In fact, this does generate a xml report which looks 1:1 to the generated fxCop report.

like image 143
Pinte Dani Avatar answered Oct 22 '22 05:10

Pinte Dani