Fork me on GitHub

FxCop

FxCop is a free static code analysis tool from Microsoft that checks .NET managed code assemblies for conformance to Microsoft's .NET Framework Design.

https://www.microsoft.com/en-us/download/details.aspx?id=6544

Install FxCop

Download and install FxCop.

Run FxCop

"C:\Program Files (x86)\Microsoft Fxcop 10.0\FxCopCmd.exe" /project:[Your FxCop file].FxCop /out:fxcop-report.xml

The report will be save to fxcop-report.xml

Generate FxCop badge

BadgesSharpCmd -o [your GitHub username] -r [your GitHub repository] -a %GITHUB_REPO_TOKEN% -b FxCop -c fxcop-report.xml

Show the badge at your GitHub repository

Edit your readme.md and add the line below:
![FxCop](https://badgessharp.apphb.com/badges/:owner/:repo/FxCop)

How use it on your Continuous Integration?

AppVeyor

Add to your AppVeyor.yml file:

after_build:
        - cmd: >
        "C:\Program Files (x86)\Microsoft Fxcop 10.0\FxCopCmd.exe" /project:[Your FxCop file].FxCop /out:fxcop-report.xml

        BadgesSharpCmd -o [your GitHub username] -r [your GitHub repository] -a %GITHUB_REPO_TOKEN% -b FxCop -c fxcop-report.xml

TeamCity

Add the 'FxCop' step to your configuration (probably you already have it);

Add a final 'Command Line' step to your configuration:

  1. Execute step: Even if some of the previous steps failed
  2. Run: Custom script
  3. Custom script:
    BadgesSharpCmd -o [your GitHub username] -r [your GitHub repository] -a %GITHUB_REPO_TOKEN% -b FxCop -c "%system.teamcity.build.tempDir%\fxcop-output-*\fxcop-result.xml"