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
In Solution Explorer, select the project. On the Analyze menu, select Run Code Analysis on [Project Name].
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.
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>.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With