Project

PSPublishModule

Build, test, version, sign, and publish PowerShell modules with reusable PowerForge pipelines.

Stars 48
Forks 16
PowerShell Gallery downloads 17,213
Release v3.0.169
Language: C# Updated: 2026-10-13

API Reference

Command

Build-PowerShellArtifact

Namespace PSPublishModule
Inputs
None
Outputs
PowerForge.PowerShellCompilationBuildResult

Builds a packaged executable, typed CLR library, or importable binary/hybrid module from PowerShell source.

Remarks

Builds a packaged executable, typed CLR library, or importable binary/hybrid module from PowerShell source.

Examples

Authored help example

Build a module from a separately reviewed dependency graph


$lock = (powerforge powershell analyze .\MyModule --output json | ConvertFrom-Json).result.dependencyGraph; Build-PowerShellArtifact -Path .\MyModule -EmitSource -DependencyLock $lock
        

Package a standalone script as a single-file executable


Build-PowerShellArtifact -Path .\tool.ps1 -AllowUnreviewedDependencies
        

Compile several loose scripts into one typed cmdlet module


Build-PowerShellArtifact -Path .\Public\Get-One.ps1, .\Public\Get-Two.ps1 -Kind BinaryModule -AllowUnreviewedDependencies
        

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

Build-PowerShellArtifact [-AllowUnreviewedDependencies] [-BuildCacheDirectory <String>] [-CertificateStoreLocation <CurrentUser|LocalMachine>] [-CertificateThumbprint <String>] [-DependencyLock <PowerShellCompilationDependencyGraph>] [-EmitIrSnapshots] [-EmitSource] [-EntryPoint <String>] [-ExcludeResource <String[]>] [-ExpectedPublicAbiSha256 <String>] [-IncludeResource <String[]>] [-KeepBuildWorkspace] [-Kind <Executable|Library|BinaryModule>] [-Mode <Analyze|Package|Hybrid|Strict>] [-Name <String>] [-Optimization <Trimmed|NativeAot>] [-OutputDirectory <String>] -Path <String[]> [-ResourceMode <Declared|CompleteModule>] [-RuntimeIdentifier <String>] [-SelfContained] [-SignArtifact] [-SigningTimeoutSeconds <Int32>] [-SingleFile <Boolean>] [-TargetContract <PowerShellCompilationTargetContract>] [-TargetFramework <String>] [-TimeoutSeconds <Int32>] [-TimeStampServer <String>] [-UseBuildCache <Boolean>] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

AllowUnreviewedDependencies SwitchParameter optionalposition: namedpipeline: False
Explicitly allow a development build to resolve dependencies without a separately reviewed lock.
BuildCacheDirectory String optionalposition: namedpipeline: False
Optional machine-local content-addressed build-cache root.
CertificateStoreLocation CertificateStoreLocation optionalposition: namedpipeline: Falsevalues: 2
Certificate store used for Authenticode signing.
Possible values: CurrentUser, LocalMachine
CertificateThumbprint String optionalposition: namedpipeline: False
Optional code-signing certificate thumbprint.
DependencyLock PowerShellCompilationDependencyGraph optionalposition: namedpipeline: False
Dependency graph produced by analysis and reviewed before this build.
EmitIrSnapshots SwitchParameter optionalposition: namedpipeline: False
Publish a redacted semantic-only bound/lowered IR snapshot beside canonical evidence.
EmitSource SwitchParameter optionalposition: namedpipeline: False
Publish an independently buildable generated C# source project beside the artifact.
EntryPoint String optionalposition: namedpipeline: False
Explicit root .ps1 application entrypoint when several script paths are supplied for an executable.
ExcludeResource String[] optionalposition: namedpipeline: False
Contained resource paths or glob patterns to exclude from optional payload.
ExpectedPublicAbiSha256 String optionalposition: namedpipeline: False
Reviewed public ABI SHA-256 that the generated artifact must match.
IncludeResource String[] optionalposition: namedpipeline: False
Contained resource paths or glob patterns to include beside the artifact.
KeepBuildWorkspace SwitchParameter optionalposition: namedpipeline: False
Retain the generated project workspace for inspection.
Kind PowerShellCompilationArtifactKind optionalposition: namedpipeline: Falsevalues: 3
Optional artifact shape. Defaults to Executable for .ps1 and BinaryModule for module inputs.
Possible values: Executable, Library, BinaryModule
Mode PowerShellCompilationMode optionalposition: namedpipeline: Falsevalues: 4
Fallback policy. Defaults to Package for executables and Hybrid for module/library inputs. Analyze is not a build mode.
Possible values: Analyze, Package, Hybrid, Strict
Name String optionalposition: namedpipeline: False
Artifact file and assembly name. Defaults to the source file name.
Optimization PowerShellCompilationExecutableOptimization optionalposition: namedpipeline: Falsevalues: 2
Optional trimmed or native-AOT publication for a Strict typed executable.
Possible values: Trimmed, NativeAot
OutputDirectory String optionalposition: namedpipeline: False
Destination for durable artifacts and the compilation manifest.
Path String[] requiredposition: 0pipeline: False
One PowerShell script/module path, or several loose .ps1 files for a typed library or strict binary module.
ResourceMode PowerShellCompilationResourceMode optionalposition: namedpipeline: Falsevalues: 2
Optional payload policy. Declared includes manifest, explicit, and safely inferred resources.
Possible values: Declared, CompleteModule
RuntimeIdentifier String optionalposition: namedpipeline: False
Optional runtime identifier used when publishing an executable.
SelfContained SwitchParameter optionalposition: namedpipeline: False
Include the .NET runtime when publishing an executable.
SignArtifact SwitchParameter optionalposition: namedpipeline: False
Authenticode-sign generated signable files before integrity hashes are recorded.
SigningTimeoutSeconds Int32 optionalposition: namedpipeline: False
Maximum time allowed for Authenticode signing.
SingleFile Boolean optionalposition: namedpipeline: False
Publish an executable as one file.
TargetContract PowerShellCompilationTargetContract optionalposition: namedpipeline: False
Explicit semantic, execution, and deployment target. Its kind and mode must match the resolved input.
TargetFramework String optionalposition: namedpipeline: False
Generated .NET target framework.
TimeoutSeconds Int32 optionalposition: namedpipeline: False
Maximum restore and compile time in seconds.
TimeStampServer String optionalposition: namedpipeline: False
RFC3161 timestamp service used for Authenticode signing.
UseBuildCache Boolean optionalposition: namedpipeline: False
Use the verified content-addressed generated-build cache.

Outputs

PowerForge.PowerShellCompilationBuildResult