Skip to content

Documentation for implementing rules in a .NET assembly #765

Open
@mattpwhite

Description

@mattpwhite

Apologies if I've just missed something, but I can't seem to find much in the way of documentation for implementing rules in a .NET assembly. I took a stab at it anyway by creating a class that implements IScriptRule, but ScriptAnalyzer can't seem to find it. I just get something like:

Invoke-ScriptAnalyzer : Exception of type 'System.Exception' was thrown.
At line:1 char:1
+ Invoke-ScriptAnalyzer -Path C:\local\test.ps1 -Cu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceExists: (Microsoft.Windo....ScriptAnalyzer:ScriptAnalyzer) [Invoke-ScriptAnalyzer], Exception
    + FullyQualifiedErrorId : Cannot find ScriptAnalyzer rules in the specified path,Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeScriptAnalyzerCommand

I've tried adding an [Export(typeof(IScriptRule))] attribute to my class, but it didn't help.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions