FxCop Class

MSBuild

Uses FxCop to analyse managed code assemblies and reports on their design best-practice compliance.


Namespace: MSBuild.Community.Tasks
Assembly: MSBuild.Community.Tasks (in MSBuild.Community.Tasks.dll)

Syntax

Visual Basic (Declaration)
Public Class FxCop
    Inherits ToolTask
C#
public class FxCop : ToolTask
C++
ref class FxCop : ToolTask
J#
public class FxCop extends ToolTask
JScript
public class FxCop extends ToolTask

Example

Shows how to analyse an assembly and use an XSLT stylesheet to present the report as an HTML file. If the static anlysis fails, the build does not stop - this is controlled with the FailOnError parameter.

 Copy Code
            <FxCop 
              TargetAssemblies="$(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.dll"
              RuleLibraries="@(FxCopRuleAssemblies)" 
              Rules="Microsoft.Design#CA1012;-Microsoft.Performance#CA1805"
              AnalysisReportFileName="Test.html"
              DependencyDirectories="$(MSBuildCommunityTasksPath)"
              FailOnError="False"
              ApplyOutXsl="True"
              OutputXslFileName="C:\Program Files\Microsoft FxCop 1.32\Xml\FxCopReport.xsl"
            />
            

Remarks

If you include the MSBuild.Community.Tasks.Targets file in you build project, the ItemGroup @(FxCopRuleAssemblies) is defined with the standard FxCop Rules Assemblies.

Inheritance Hierarchy

System.Object
   Microsoft.Build.Utilities.Task
      Microsoft.Build.Utilities.ToolTask
         MSBuild.Community.Tasks.FxCop

Thread Safety

Public static (Shared in Visual Basic)staticShared members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

See Also

Syntax based on .NET Framework version 2.0.
Documentation version 1.0.0.0.