Skip to content

Latest commit

 

History

History
49 lines (31 loc) · 942 Bytes

UseToExportFieldsInManifest.md

File metadata and controls

49 lines (31 loc) · 942 Bytes

UseToExportFieldsInManifest

Severity Level: Warning

Description

To improve the performance of module auto-discovery, module manifests should not use wildcards ('*') or null ($null) in the following entries:

  • AliasesToExport
  • CmdletsToExport
  • FunctionsToExport
  • VariablesToExport

The use of wildcards or null has the potential to cause PowerShell to perform expensive work to analyse a module during module auto-discovery.

How

Use an explicit list in the entries.

Example

Suppose there are no functions in your module to export. Then,

Wrong

FunctionsToExport = $null

Correct

FunctionToExport = @()

Example

Suppose there are only two functions in your module, Get-Foo and Set-Foo that you want to export. Then,

Wrong

FunctionsToExport = '*'

Correct

FunctionToExport = @(Get-Foo, Set-Foo)