# Build-PowerShellArtifact

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

Project

PSPublishModule

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

[View on GitHub](https://github.com/EvotecIT/PSPublishModule) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSPublishModule/releases/tag/v3.0.124) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSPublishModule/2.0.27)

Stars **48**

Forks **15**

Open issues **1**

PowerShell Gallery downloads **17,213**

Release **v3.0.195**

Language: C# Updated: 2026-11-25

Command 

**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>]
```

[#](#member-8e4baf7f430cb864499e0cdc)

Parameter set: `All Parameter Sets`

## Examples

### Build a module from a separately reviewed dependency graph

```powershell
$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

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

### Compile several loose scripts into one typed cmdlet module

```powershell
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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:17C28D6FC3F42319E28C36951959E28618DA98DF46EE82FAE164116CA9032483 -->
