Windows-powershell / PowerShell-master /.github /instructions /start-psbuild-basics.instructions.md
Onyxl's picture
Upload 2661 files
8c763fb verified
metadata
applyTo:
  - build.psm1
  - tools/ci.psm1
  - .github/**/*.yml
  - .github/**/*.yaml

Start-PSBuild Basics

Purpose

Start-PSBuild builds PowerShell from source. It's defined in build.psm1 and used in CI/CD workflows.

Default Usage

For most scenarios, use with no parameters:

Import-Module ./tools/ci.psm1
Start-PSBuild

Default behavior:

  • Configuration: Debug
  • PSModuleRestore: Enabled
  • Runtime: Auto-detected for platform

Common Configurations

Debug Build (Default)

Start-PSBuild

Use for:

  • Testing (xUnit, Pester)
  • Development
  • Debugging

Release Build

Start-PSBuild -Configuration 'Release'

Use for:

  • Production packages
  • Distribution
  • Performance testing

Code Coverage Build

Start-PSBuild -Configuration 'CodeCoverage'

Use for:

  • Code coverage analysis
  • Test coverage reports

Common Parameters

-Configuration

Values: Debug, Release, CodeCoverage, StaticAnalysis

Default: Debug

-CI

Restores Pester module for CI environments.

Start-PSBuild -CI

-PSModuleRestore

Now enabled by default. Use -NoPSModuleRestore to skip.

-ReleaseTag

Specifies version tag for release builds:

$releaseTag = Get-ReleaseTag
Start-PSBuild -Configuration 'Release' -ReleaseTag $releaseTag

Workflow Example

- name: Build PowerShell
  shell: pwsh
  run: |
    Import-Module ./tools/ci.psm1
    Start-PSBuild