Evotec

Project

PSPublishModule

PSPublishModule is an open-source PowerShell and .NET project with packages, release history, and technical documentation.

Stars 43
Forks 13
Open issues 1
PowerShell Gallery downloads 13,876
Release v3.0.3
Language: C# Updated: 2026-04-14

API Reference

Cmdlet

New-ConfigurationModule

Namespace PSPublishModule
Inputs
None
Outputs
System.Object

Provides a way to configure required, external, or approved modules used in the project.

Remarks

Emits module dependency configuration segments. These are later used to patch the module manifest and (optionally) install/package dependencies during a build. Use RequiredModule for dependencies that should appear in the manifest and can also be bundled into build artefacts when New-ConfigurationArtefact -AddRequiredModules is enabled. Use ExternalModule for dependencies that must exist on the target system but should not be bundled into artefacts. RequiredModule entries are written to the manifest RequiredModules. ExternalModule entries are written to PrivateData.PSData.ExternalModuleDependencies. ApprovedModule entries are used by merge/missing-function workflows and are not emitted as manifest dependencies. Built-in Microsoft.PowerShell.* modules are ignored during manifest refresh because they are inbox runtime modules, not gallery-resolvable dependencies. Version and Guid values set to Auto or Latest are resolved from installed modules by default. When New-ConfigurationBuild -ResolveMissingModulesOnline is enabled, repository results can be used without installing the dependency first. Choose only one versioning style per dependency: a minimum version (-Version or -MinimumVersion) or an exact version (-RequiredVersion). Mixing them for the same module is treated as invalid input.

Examples

Authored help example

Add a required module dependency

PS>


New-ConfigurationModule -Type RequiredModule -Name 'Pester' -Version '5.6.1'
        

Declares a required dependency that is written into the manifest.

Add an external module (required but not packaged)

PS>


New-ConfigurationModule -Type ExternalModule -Name 'Az.Accounts' -Version 'Latest'
        

Declares a dependency that is expected to be installed separately (not bundled into artefacts).

Pin an exact required version

PS>


New-ConfigurationModule -Type RequiredModule -Name 'PSWriteColor' -RequiredVersion '1.0.0'
        

Uses RequiredVersion when an exact match is required.

Declare an approved helper module for merge-time reuse

PS>


New-ConfigurationModule -Type ApprovedModule -Name 'PSSharedGoods','PSWriteColor'
        

Allows approved helper functions to be copied into the built module when they are actually used.

Declare a dependency whose version can be resolved online later

PS>


New-ConfigurationModule -Type RequiredModule -Name 'Pester' -Version 'Latest' -Guid 'Auto'
        

Pairs well with New-ConfigurationBuild -ResolveMissingModulesOnline when the module is not installed locally.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.

Syntax

New-ConfigurationModule [-Guid <String>] [-MinimumVersion <String>] -Name <String[]> [-RequiredVersion <String>] [-Type <RequiredModule|ExternalModule|ApprovedModule>] [-Version <String>] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

Guid String optionalposition: namedpipeline: False
GUID of the dependency module (or Auto). This is most useful when you want manifest validation to lock onto a specific module identity across repositories.
MinimumVersion String optionalposition: namedpipeline: False
Minimum version of the dependency module (preferred over -Version). Use this when any newer compatible version is acceptable.
Name String[] requiredposition: namedpipeline: False
Name of the PowerShell module(s) that your module depends on. Multiple names emit one configuration segment per module using the same dependency settings.
RequiredVersion String optionalposition: namedpipeline: False
Required version of the dependency module (exact match). Use this when consumers and packaging must resolve the exact same version.
Type ModuleDependencyKind optionalposition: namedpipeline: Falsevalues: 3
Choose between RequiredModule, ExternalModule, and ApprovedModule. RequiredModule is used for manifest and optional packaging, ExternalModule is install-only, and ApprovedModule is merge-only.
Possible values: RequiredModule, ExternalModule, ApprovedModule
Version String optionalposition: namedpipeline: False
Minimum version of the dependency module (or Auto/Latest). This is treated the same as -MinimumVersion and cannot be combined with -RequiredVersion.

Outputs

System.Object