FxCop
  • 12 Jan 2023
  • 1 Minute to read
  • Dark
    Light
  • PDF

FxCop

  • Dark
    Light
  • PDF

Article Summary

FxCop & FxCop Analyzers

FxCop is a free, static code analysis tool from Microsoft that checks .NET managed code assemblies for conformance to Microsoft's .NET Framework Design Guidelines. While technically speaking FxCop is deprecated in favor of Roslyn Analyzers, many projects still depend on it for code quality.

Running FxCop

FxCop is executed during a build in Visual Studio, and also by the FxCopCmd.exe utility that ships with Visual Studio Enterprise.

Running FxCop in BuildMaster

Any configured Roslyn Analyzers will already automatically be executed during the build process as long as a project's NuGet packages are restored, and the project is compiled with MSBuild.

Alternatively, BuildMaster can execute FxCop in a build or deploy plan, then capture the output from the report into a build report.

Pre-requisites:

Example plan:

Exec "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Team Tools\Static Analysis Tools\FxCop\FxCopCmd.exe"
(
    Arguments: /out:report.xml 
);
 
Capture-FileReport
(
    Path: report.xml
);

Was this article helpful?