Search Wiki:

FxCop Rules for Windows PowerShell


FxCop Rules for Windows PowerShell tests your cmdlet code and determines whether it complies with Windows PowerShell guidelines, such as the use of singular nouns in parameter names, and avoids common errors, such as accessing a pipeline parameter outside of a ProcessRecord method.

FxCop is a program that analyzes managed code assemblies and reports information about the assemblies—such as possible design, localization, performance, and security flaws—and potential improvements.

You can use FxCop to perform a static analysis of Windows PowerShell code assemblies to improve the quality of your code. This static analysis is implemented as a library of FxCop rules.


NOTE: FxCop Rules for Windows PowerShell is provided to the public as a convenience. It is not an officially supported Windows PowerShell product release. To report bugs, ask questions, or comment on this tool, visit Microsoft Connect at



Use the following procedure to download the required components.

1. Download Microsoft FxCop 10.0 from the Microsoft Download Center at

2. Download Microsoft.PowerShell.CodeAnalysis.dll from the MSDN Code Gallery at Save the file in any location.


Use the following procedure to configure Microsoft FxCop to run FxCop for Windows PowerShell on your code.

1. Click Start and then click Microsoft FxCop 10.0.

2. From the Project menu, select Add Rules, navigate to the Microsoft.PowerShell.CodeAnalysis.dll file, and click Open.

3. From the Project menu, select Add Targets, navigate to the .dll file that implements your cmdlets, and click Open.

4. From the Project menu, select Analyze or press F5.

List of Rules

Last edited Sep 2 2010 at 5:07 AM  by JuneB, version 14
Page view tracker