March 30th, 2010

Testing cmdlets with FxCop

PowerShell Team
PowerShell Team

Windows PowerShell wouldn’t be very useful without all the great cmdlets that actually manage specific technologies.  We want to help cmdlet developers to create high-quality cmdlets.  Today we announce availability of FxCop rules that can be used to verify compliance with some of the Cmdlet Design Guidelines as well as to find some of the common bugs.

Installation

Use the following procedure to download the required components:

  1. Download Microsoft FxCop 1.36 from the Microsoft Download Center at http://go.microsoft.com/fwlink/?LinkID=185006.
  2. Download Microsoft.PowerShell.CodeAnalysis.dll from the MSDN Code Gallery at http://go.microsoft.com/fwlink/?LinkId=185007. Save the file in any location.

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

  1. Click Start and then click Microsoft FxCop 1.36.
  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.

Please refer to the FxCop Rules for Windows PowerShell project on Code Gallery for more details.

List of rules

Thanks,

Lukasz Anforowicz [MSFT]
Windows PowerShell Developer
Microsoft Corporation

Category
PowerShell

Author

PowerShell Team
PowerShell Team

PowerShell is a task-based command-line shell and scripting language built on .NET. PowerShell helps system administrators and power-users rapidly automate tasks that manage operating systems (Linux, macOS, and Windows) and processes.

0 comments

Discussion are closed.