How to trace behavior of command line code analyzer

When you enable code analysis on build, the command line code analyzer (%APPDATA%\FxCop Integrator\CodeAnalysis.exe) will be used to analyze your project. This is a .NET console application, and uses TraceSource class to write trace logs. So, you can trace behavior of this tool with TraceListener classes.
  • Step 1
Create CodeAnalysis.exe.config in the %APPDATA%\FxCop Integrator folder.
  • Step 2
Add a trace source named "logger" and any trace listeners to the config file, as follows.
<?xml version="1.0"?>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
      <source name="logger" switchName="sourceSwitch" switchType="System.Diagnostics.SourceSwitch">
          <add name="logFile"/>
      <add name="sourceSwitch" value="All"/>
      <add name="logFile" type="System.Diagnostics.TextWriterTraceListener" initializeData="C:\tmp\trace.txt"/>
  • Step 3
Build your project again.

Last edited Nov 4, 2011 at 2:01 PM by sasaminn, version 3


No comments yet.