Export-PSScriptBuilderBuildResult¶
Exports a build result to a JSON file.
Description¶
Serializes a PSScriptBuilderBuildResult to a structured JSON file — useful as a CI artifact for
auditing, debugging, or tracking changes between builds. Always includes the build summary
(output path, file size, syntax validation status, execution time, and component counts) plus an
automatically-added UTC generation timestamp.
Add -Detailed to also include every processed source file and, per component, its source file
and dependencies.
The target directory is created automatically if it doesn't exist; relative paths are resolved against the project root (see Set-PSScriptBuilderProjectRoot).
Parameters¶
| Name | Type | Description |
|---|---|---|
-BuildResult |
PSScriptBuilderBuildResult |
Required. The result to export, typically piped directly from Invoke-PSScriptBuilderBuild. |
-Path |
string | Required. Path to the JSON file to write. |
-Detailed |
switch | Also include every processed source file and each component's source file and dependencies. |
-Force |
switch | Overwrite the target file if it already exists. Without it, an existing file causes an IOException. |
Examples¶
Export a compact build summary¶
Export the full detail, overwriting an existing report¶
Build, display, and export in one pipeline¶
$result = Invoke-PSScriptBuilderBuild @buildParams
$result | Format-PSScriptBuilderBuildResult
$result | Export-PSScriptBuilderBuildResult -Path ".\build\reports\build.json" -Force
Output¶
Returns the resolved absolute path of the written JSON file, as a string.