API Reference
New-ConfigurationBuild
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
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>]
#
All Parameter SetsParameters
- AutoSwitchExactOnPublish SwitchParameter
- Auto switch VersionedInstallStrategy to Exact when publishing.
- CertificatePFXBase64 String
- Base64 string of a PFX containing a code-signing certificate.
- CertificatePFXPassword String
- Password for the PFX provided via CertificatePFXPath or CertificatePFXBase64.
- CertificatePFXPath String
- Path to a PFX containing a code-signing certificate.
- CertificateThumbprint String
- Thumbprint of a code-signing certificate from the local cert store.
- DeleteTargetModuleBeforeBuild SwitchParameter
- Delete target module before build.
- DoNotAttemptToFixRelativePaths SwitchParameter
- Do not attempt to fix relative paths during merge.
- DotSourceClasses SwitchParameter
- Keep classes in a separate dot-sourced file instead of merging into the main PSM1.
- DotSourceLibraries SwitchParameter
- Keep library-loading code in a separate dot-sourced file.
- Enable SwitchParameter
- Enable build process.
- InstallMissingModules SwitchParameter
- Install missing module dependencies (RequiredModule/ExternalModule) before build. This affects the build host only; it does not bundle modules into artefacts.
- InstallMissingModulesCredentialSecret String
- 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
- Path to a file containing the credential secret or token. This is often the safest option for automation and CI agents.
- InstallMissingModulesCredentialUserName String
- Credential user name for dependency installation. This is usually paired with InstallMissingModulesCredentialSecret or InstallMissingModulesCredentialSecretFilePath.
- InstallMissingModulesForce SwitchParameter
- 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
- Allow prerelease versions when installing dependencies. Use this only when the dependency declaration and repository policy intentionally allow prerelease packages.
- InstallMissingModulesRepository String
- 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
- Kill locking processes before install.
- KillLockersForce SwitchParameter
- Force killing locking processes before install.
- LocalVersioning SwitchParameter
- Use local versioning (bump PSD1 version on each build without querying PSGallery).
- MergeFunctionsFromApprovedModules SwitchParameter
- When merging, also include functions from ApprovedModules referenced by the module.
- MergeModuleOnBuild SwitchParameter
- Merge module on build (combine Private/Public/Classes/Enums into one PSM1).
- NETBinaryModule String[]
- Binary module names (DLL file names) to import in the module.
- NETBinaryModuleCmdletScanDisabled SwitchParameter
- Disable cmdlet scanning for the binary module.
- NETBinaryModuleDocumentation SwitchParameter
- Enable binary module documentation.
- NETConfiguration String
- Build configuration for .NET projects (Release or Debug).
- Possible values:
Release,Debug - NETDoNotCopyLibrariesRecursively SwitchParameter
- Do not copy libraries recursively (legacy option).
- NETExcludeLibraryFilter String[]
- Filters for libraries that should be excluded from build output.
- NETExcludeMainLibrary SwitchParameter
- Exclude main library from build output.
- NETFramework String[]
- Target frameworks for .NET build.
- NETHandleAssemblyWithSameName SwitchParameter
- Handle 'assembly with same name is already loaded' by wrapping Add-Type logic.
- NETHandleRuntimes SwitchParameter
- Handle runtimes folder when copying libraries.
- NETIgnoreLibraryOnLoad String[]
- Exclude libraries from being loaded by PSM1/Libraries.ps1.
- NETLineByLineAddType SwitchParameter
- Add-Type libraries line by line (legacy debugging option).
- NETMergeLibraryDebugging SwitchParameter
- Debug DLL merge (legacy setting).
- NETProjectName String
- Project name for the .NET project (required when NETProjectPath is provided).
- NETProjectPath String
- Path to the .NET project to build (useful when not in Sources folder).
- NETResolveBinaryConflicts SwitchParameter
- Enable resolving binary conflicts.
- NETResolveBinaryConflictsName String
- Project name used when resolving binary conflicts.
- NETSearchClass String
- Search class (legacy option).
- RefreshPSD1Only SwitchParameter
- Only regenerate the manifest (PSD1) without rebuilding/merging other artefacts.
- ResolveMissingModulesOnline SwitchParameter
- 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
- Write library-loading code into a distinct file and reference it via ScriptsToProcess/DotSource.
- SignCustomInclude String[]
- Override include patterns passed to the signer.
- SignExcludePaths String[]
- Additional path substrings to exclude from signing.
- SignIncludeBinaries SwitchParameter
- When signing is enabled, binaries are signed by default (e.g., .dll, .cat). Use -SignIncludeBinaries:$false to opt out.
- SignIncludeExe SwitchParameter
- When signing is enabled, include .exe files in signing.
- SignIncludeInternals SwitchParameter
- When signing is enabled, also sign scripts that reside under the Internals folder.
- SignModule SwitchParameter
- Enable code-signing for the built module output.
- SignOverwriteSigned SwitchParameter
- When signing is enabled, overwrite existing signatures (re-sign files).
- SkipBuiltinReplacements SwitchParameter
- Disables built-in replacements done by the module builder.
- SyncNETProjectVersion SwitchParameter
- 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
- Export all functions/aliases via wildcard in PSD1.
- VersionedInstallKeep Int32
- How many versions to keep per module when using versioned installs.
- VersionedInstallLegacyFlatHandling Nullable`1
- How to handle legacy flat module installs during install.
- VersionedInstallPreserveVersions String[]
- Version folders to preserve during install pruning (for example older major versions).
- VersionedInstallStrategy Nullable`1
- Controls how the module is installed into user Module roots after build.
- WarnIfRequiredModulesOutdated SwitchParameter
- 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