description | ms.date | ms.topic | title |
---|---|---|---|
Use the *ToExport module manifest fields. |
06/28/2023 |
reference |
UseToExportFieldsInManifest |
Severity Level: Warning
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
Using wildcards or null has causes PowerShell to perform expensive work to analyze a module during module auto-discovery.
Use an explicit list in the entries.
Suppose there are no functions in your module to export. Then,
FunctionsToExport = $null
FunctionToExport = @()
Suppose there are only two functions in your module, Get-Foo
and Set-Foo
that you want to
export. Then,
FunctionsToExport = '*'
FunctionToExport = @(Get-Foo, Set-Foo)