Skip to content

Manifest cleanup required #269

Closed

Description

@KirkMunro

The module manifests are still improperly configured, such that they will hurt PowerShell performance.

The Microsoft.Graph module manifest still contains this in its definition:

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = '*'

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = '*'

# Variables to export from this module
VariablesToExport = '*'

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = '*'

Note the comment above FunctionsToExport, CmdletsToExport, and AliasesToExport. Each of these values should be assigned to an empty array (@()), like this:

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = @()

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()

# Variables to export from this module
VariablesToExport = '*'

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = @()

Note that VariablesToExport is not the same, so you can leave that one as is.

Also, with this approach on your main module, you don't have to worry about your commands not being visible in PowerShell, because the individual modules listed in the RequiredModules list will be loaded and their commands will be properly exported, even with this change. The *ToExport values are only used to define exports coming from the current module (the module to which the manifest applies) or nested modules (nested modules are loaded inside a module scope, required modules are loaded side-by-side).

Further, each of the Microsoft.Graph.* modules still defines AliasesToExport like this:

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = '*'

These each need to be updated to define AliasesToExport like this instead:

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = @()

You can monitor for these anomalies by running this PowerShell command from the root of your Modules folder:

gci -r -fi Microsoft.Graph*.psd1 | sls '(Functions|Aliases|Cmdlets)ToExport\s*=\s*''\*'''

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions