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.186
Language: C# Updated: 2026-11-04
Command

Build-PowerShellArtifact

Module
PSPublishModule
Inputs
None
Outputs
PowerForge.PowerShellCompilationBuildResult

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

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

Examples

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

Parameters

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

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.