eckes
eckes

Reputation: 67057

Is it possible to have Code Analysis warnings formatted like normal ones?

I like the code analysis included in VS2012. But it's a bit annoying that the warnings are only processable in the Code Analysis window, and not by stepping through the build output with F4.

Is there a way to overcome this limitation? How could I format the output of the static code analysis like normal compiler output (i.e. don't only print the filename but the correct path to the file being inspected)?

I'm not using FxCop since I'm working with unmanaged code.

Upvotes: 3

Views: 775

Answers (1)

Nicole Calinoiu
Nicole Calinoiu

Reputation: 20992

For unmanaged code analysis, the MSBuild scripts use /analyze:quiet instead of /analyze in order to prevent writing results to the error list. The simplest way to change the behavior would be to modify your Microsoft.CodeAnalysis.Targets file (typically located at C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\CodeAnalysis\Microsoft.CodeAnalysis.Targets) to avoid specifying quiet mode. i.e.: Change the line

<AdditionalOptions Condition="'$(PlatformToolsetVersion)'&gt;='110'">%(ClCompile.AdditionalOptions)  /analyze:quiet</AdditionalOptions>

to

<AdditionalOptions Condition="'$(PlatformToolsetVersion)'&gt;='110'">%(ClCompile.AdditionalOptions)  /analyze</AdditionalOptions>

Upvotes: 3

Related Questions