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-ConfigurationBuild

Namespace PSPublishModule
Inputs
None
Outputs
System.Object

Allows configuring the build process for a module.

Remarks

This cmdlet emits build configuration that is consumed by Invoke-ModuleBuild / Build-Module. It controls how the module is merged, signed, versioned, installed, and how optional .NET publishing is performed. Dependency-related options in this cmdlet affect the build machine, not artefact packaging. Use InstallMissingModules when the build host needs missing RequiredModule or ExternalModule dependencies installed before merge/import/test steps run. If you want dependencies copied into ZIP/unpacked artefacts, configure that separately with New-ConfigurationArtefact -AddRequiredModules. Build-time installation and artefact packaging are designed as separate decisions because many teams want one without the other. For a broader dependency workflow explanation, see about_ModuleDependencies.

Examples

Authored help example

Enable build and module merge, and keep a few installed versions


New-ConfigurationBuild -Enable -MergeModuleOnBuild -LocalVersioning -VersionedInstallStrategy AutoRevision -VersionedInstallKeep 3
        

Enable signing and terminate locking processes before install


New-ConfigurationBuild -Enable -SignModule -CertificateThumbprint '0123456789ABCDEF' -KillLockersBeforeInstall -KillLockersForce
        

Install missing dependencies from PSGallery before the build


New-ConfigurationBuild -Enable -InstallMissingModules -InstallMissingModulesRepository 'PSGallery'
        

Use this when the build host does not already have the declared RequiredModule or ExternalModule dependencies installed.

Resolve Auto or Latest online without installing first


New-ConfigurationBuild -Enable -ResolveMissingModulesOnline -WarnIfRequiredModulesOutdated
        

Useful in CI or on clean machines when dependency versions should come from the repository rather than the local module cache.

Install from a private repository with a token stored in a file


New-ConfigurationBuild -Enable -InstallMissingModules -InstallMissingModulesRepository 'MyPrivateFeed' -InstallMissingModulesCredentialUserName 'build' -InstallMissingModulesCredentialSecretFilePath '.secrets\feed-token.txt'
        

Use the credential parameters only when the repository requires authentication.

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-ConfigurationBuild [-AutoSwitchExactOnPublish] [-CertificatePFXBase64 <String>] [-CertificatePFXPassword <String>] [-CertificatePFXPath <String>] [-CertificateThumbprint <String>] [-DeleteTargetModuleBeforeBuild] [-DoNotAttemptToFixRelativePaths] [-DotSourceClasses] [-DotSourceLibraries] [-Enable] [-InstallMissingModules] [-InstallMissingModulesCredentialSecret <String>] [-InstallMissingModulesCredentialSecretFilePath <String>] [-InstallMissingModulesCredentialUserName <String>] [-InstallMissingModulesForce] [-InstallMissingModulesPrerelease] [-InstallMissingModulesRepository <String>] [-KillLockersBeforeInstall] [-KillLockersForce] [-LocalVersioning] [-MergeFunctionsFromApprovedModules] [-MergeModuleOnBuild] [-NETBinaryModule <String[]>] [-NETBinaryModuleCmdletScanDisabled] [-NETBinaryModuleDocumentation] [-NETConfiguration <Release|Debug>] [-NETDoNotCopyLibrariesRecursively] [-NETExcludeLibraryFilter <String[]>] [-NETExcludeMainLibrary] [-NETFramework <String[]>] [-NETHandleAssemblyWithSameName] [-NETHandleRuntimes] [-NETIgnoreLibraryOnLoad <String[]>] [-NETLineByLineAddType] [-NETMergeLibraryDebugging] [-NETProjectName <String>] [-NETProjectPath <String>] [-NETResolveBinaryConflicts] [-NETResolveBinaryConflictsName <String>] [-NETSearchClass <String>] [-RefreshPSD1Only] [-ResolveMissingModulesOnline] [-SeparateFileLibraries] [-SignCustomInclude <String[]>] [-SignExcludePaths <String[]>] [-SignIncludeBinaries] [-SignIncludeExe] [-SignIncludeInternals] [-SignModule] [-SignOverwriteSigned] [-SkipBuiltinReplacements] [-SyncNETProjectVersion] [-UseWildcardForFunctions] [-VersionedInstallKeep <Int32>] [-VersionedInstallLegacyFlatHandling <Nullable`1>] [-VersionedInstallPreserveVersions <String[]>] [-VersionedInstallStrategy <Nullable`1>] [-WarnIfRequiredModulesOutdated] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

AutoSwitchExactOnPublish SwitchParameter optionalposition: namedpipeline: False
Auto switch VersionedInstallStrategy to Exact when publishing.
CertificatePFXBase64 String optionalposition: namedpipeline: False
Base64 string of a PFX containing a code-signing certificate.
CertificatePFXPassword String optionalposition: namedpipeline: False
Password for the PFX provided via CertificatePFXPath or CertificatePFXBase64.
CertificatePFXPath String optionalposition: namedpipeline: False
Path to a PFX containing a code-signing certificate.
CertificateThumbprint String optionalposition: namedpipeline: False
Thumbprint of a code-signing certificate from the local cert store.
DeleteTargetModuleBeforeBuild SwitchParameter optionalposition: namedpipeline: False
Delete target module before build.
DoNotAttemptToFixRelativePaths SwitchParameter optionalposition: namedpipeline: False
Do not attempt to fix relative paths during merge.
DotSourceClasses SwitchParameter optionalposition: namedpipeline: False
Keep classes in a separate dot-sourced file instead of merging into the main PSM1.
DotSourceLibraries SwitchParameter optionalposition: namedpipeline: False
Keep library-loading code in a separate dot-sourced file.
Enable SwitchParameter optionalposition: namedpipeline: False
Enable build process.
InstallMissingModules SwitchParameter optionalposition: namedpipeline: False
Install missing module dependencies (RequiredModule/ExternalModule) before build. This affects the build host only; it does not bundle modules into artefacts.
InstallMissingModulesCredentialSecret String optionalposition: namedpipeline: False
Credential secret or token for dependency installation. Prefer the file-path form in CI when you do not want the secret value embedded directly in scripts.
InstallMissingModulesCredentialSecretFilePath String optionalposition: namedpipeline: False
Path to a file containing the credential secret or token. This is often the safest option for automation and CI agents.
InstallMissingModulesCredentialUserName String optionalposition: namedpipeline: False
Credential user name for dependency installation. This is usually paired with InstallMissingModulesCredentialSecret or InstallMissingModulesCredentialSecretFilePath.
InstallMissingModulesForce SwitchParameter optionalposition: namedpipeline: False
Force re-install or update even if dependencies are already installed. Useful when you want the build host to re-sync against the repository instead of accepting the current local state.
InstallMissingModulesPrerelease SwitchParameter optionalposition: namedpipeline: False
Allow prerelease versions when installing dependencies. Use this only when the dependency declaration and repository policy intentionally allow prerelease packages.
InstallMissingModulesRepository String optionalposition: namedpipeline: False
Repository name used for dependency installation (defaults to PSGallery). Set this when your build should resolve dependencies from a named private feed or alternate gallery.
KillLockersBeforeInstall SwitchParameter optionalposition: namedpipeline: False
Kill locking processes before install.
KillLockersForce SwitchParameter optionalposition: namedpipeline: False
Force killing locking processes before install.
LocalVersioning SwitchParameter optionalposition: namedpipeline: False
Use local versioning (bump PSD1 version on each build without querying PSGallery).
MergeFunctionsFromApprovedModules SwitchParameter optionalposition: namedpipeline: False
When merging, also include functions from ApprovedModules referenced by the module.
MergeModuleOnBuild SwitchParameter optionalposition: namedpipeline: False
Merge module on build (combine Private/Public/Classes/Enums into one PSM1).
NETBinaryModule String[] optionalposition: namedpipeline: False
Binary module names (DLL file names) to import in the module.
NETBinaryModuleCmdletScanDisabled SwitchParameter optionalposition: namedpipeline: False
Disable cmdlet scanning for the binary module.
NETBinaryModuleDocumentation SwitchParameter optionalposition: namedpipeline: Falsealiases: NETBinaryModuleDocumenation, NETDocumentation
Enable binary module documentation.
NETConfiguration String optionalposition: namedpipeline: Falsevalues: 2
Build configuration for .NET projects (Release or Debug).
Possible values: Release, Debug
NETDoNotCopyLibrariesRecursively SwitchParameter optionalposition: namedpipeline: False
Do not copy libraries recursively (legacy option).
NETExcludeLibraryFilter String[] optionalposition: namedpipeline: False
Filters for libraries that should be excluded from build output.
NETExcludeMainLibrary SwitchParameter optionalposition: namedpipeline: False
Exclude main library from build output.
NETFramework String[] optionalposition: namedpipeline: False
Target frameworks for .NET build.
NETHandleAssemblyWithSameName SwitchParameter optionalposition: namedpipeline: Falsealiases: HandleAssemblyWithSameName
Handle 'assembly with same name is already loaded' by wrapping Add-Type logic.
NETHandleRuntimes SwitchParameter optionalposition: namedpipeline: False
Handle runtimes folder when copying libraries.
NETIgnoreLibraryOnLoad String[] optionalposition: namedpipeline: False
Exclude libraries from being loaded by PSM1/Libraries.ps1.
NETLineByLineAddType SwitchParameter optionalposition: namedpipeline: False
Add-Type libraries line by line (legacy debugging option).
NETMergeLibraryDebugging SwitchParameter optionalposition: namedpipeline: Falsealiases: MergeLibraryDebugging
Debug DLL merge (legacy setting).
NETProjectName String optionalposition: namedpipeline: False
Project name for the .NET project (required when NETProjectPath is provided).
NETProjectPath String optionalposition: namedpipeline: False
Path to the .NET project to build (useful when not in Sources folder).
NETResolveBinaryConflicts SwitchParameter optionalposition: namedpipeline: Falsealiases: ResolveBinaryConflicts
Enable resolving binary conflicts.
NETResolveBinaryConflictsName String optionalposition: namedpipeline: Falsealiases: ResolveBinaryConflictsName
Project name used when resolving binary conflicts.
NETSearchClass String optionalposition: namedpipeline: False
Search class (legacy option).
RefreshPSD1Only SwitchParameter optionalposition: namedpipeline: False
Only regenerate the manifest (PSD1) without rebuilding/merging other artefacts.
ResolveMissingModulesOnline SwitchParameter optionalposition: namedpipeline: False
Resolve Auto/Latest dependency versions from the repository without installing. When not explicitly set, this is auto-enabled if any RequiredModules use Auto/Latest/Guid Auto.
SeparateFileLibraries SwitchParameter optionalposition: namedpipeline: False
Write library-loading code into a distinct file and reference it via ScriptsToProcess/DotSource.
SignCustomInclude String[] optionalposition: namedpipeline: False
Override include patterns passed to the signer.
SignExcludePaths String[] optionalposition: namedpipeline: False
Additional path substrings to exclude from signing.
SignIncludeBinaries SwitchParameter optionalposition: namedpipeline: False
When signing is enabled, binaries are signed by default (e.g., .dll, .cat). Use -SignIncludeBinaries:$false to opt out.
SignIncludeExe SwitchParameter optionalposition: namedpipeline: False
When signing is enabled, include .exe files in signing.
SignIncludeInternals SwitchParameter optionalposition: namedpipeline: False
When signing is enabled, also sign scripts that reside under the Internals folder.
SignModule SwitchParameter optionalposition: namedpipeline: False
Enable code-signing for the built module output.
SignOverwriteSigned SwitchParameter optionalposition: namedpipeline: False
When signing is enabled, overwrite existing signatures (re-sign files).
SkipBuiltinReplacements SwitchParameter optionalposition: namedpipeline: False
Disables built-in replacements done by the module builder.
SyncNETProjectVersion SwitchParameter optionalposition: namedpipeline: False
Synchronize the source .NET project version with the resolved module/manifest version before staging. This is opt-in and updates the source .csproj file when a project path can be resolved.
UseWildcardForFunctions SwitchParameter optionalposition: namedpipeline: False
Export all functions/aliases via wildcard in PSD1.
VersionedInstallKeep Int32 optionalposition: namedpipeline: False
How many versions to keep per module when using versioned installs.
VersionedInstallLegacyFlatHandling Nullable`1 optionalposition: namedpipeline: False
How to handle legacy flat module installs during install.
VersionedInstallPreserveVersions String[] optionalposition: namedpipeline: False
Version folders to preserve during install pruning (for example older major versions).
VersionedInstallStrategy Nullable`1 optionalposition: namedpipeline: False
Controls how the module is installed into user Module roots after build.
WarnIfRequiredModulesOutdated SwitchParameter optionalposition: namedpipeline: False
Warn if RequiredModule entries are older than the latest version available in the repository. This is a reporting hint and does not change the manifest or install anything by itself.

Outputs

System.Object