Search Wiki:

DefineCmdletInTheCorrectNamespace


TypeName DefineCmdletInTheCorrectNamespace
CheckId PS1011
Error-Level Information
Category Microsoft.PowerShell
Certainty 95%
BreakingChange Breaking
Cause The namespace in which the cmdlet is implemented has the wrong name format.
Rule descriptionThe namespace in which the cmdlet class is defined must have a name in the following format: "<Product>.Commands". For example, the Windows PowerShell Core cmdlets are defined in the Microsoft.PowerShell.Commands namespace.
How to fix violations Rename the namespace, or move the cmdlet class to a namespace that conforms to the standards for naming a namespace.
When to exclude warnings Do not suppress warnings from this rule.
Related rules FollowCmdletClassNamingConvention
See also FxCop Rules for Windows PowerShell

Examples


// Example of a namespace that violates this rule.

namespace StringLibrary
{
    [Cmdlet("Write", "String")]
    public class WriteStringCommand : PSCmdlet
    {
        // ...
    }
}

// Example of a namespace that follows this rule.
namespace Fabrikam.StringLibrary.Commands
{
    [Cmdlet("Write", "String")]
    public class WriteStringCommand : PSCmdlet
    {
        // ...
    }
}


Back to FxCop Rules for Windows PowerShell.
Last edited Mar 24 2010 at 11:55 PM  by JuneB, version 1
Updating...
Page view tracker