Title: [Article] Build one PowerShell script from many files with PSScriptBuilder · Issue #504 · PowerShellOrg/PowerShellOrgWebsite · GitHub
Open Graph Title: [Article] Build one PowerShell script from many files with PSScriptBuilder · Issue #504 · PowerShellOrg/PowerShellOrgWebsite
X Title: [Article] Build one PowerShell script from many files with PSScriptBuilder · Issue #504 · PowerShellOrg/PowerShellOrgWebsite
Description: Article Title Build one PowerShell script from many files with PSScriptBuilder Author Name Tim Hartling Submission Type Pitch — I'd like feedback before writing Description Build a PowerShell project from many files into one script with ...
Open Graph Description: Article Title Build one PowerShell script from many files with PSScriptBuilder Author Name Tim Hartling Submission Type Pitch — I'd like feedback before writing Description Build a PowerShell proje...
X Description: Article Title Build one PowerShell script from many files with PSScriptBuilder Author Name Tim Hartling Submission Type Pitch — I'd like feedback before writing Description Build a PowerShell p...
Opengraph URL: https://github.com/PowerShellOrg/PowerShellOrgWebsite/issues/504
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Article] Build one PowerShell script from many files with PSScriptBuilder","articleBody":"### Article Title\n\nBuild one PowerShell script from many files with PSScriptBuilder\n\n### Author Name\n\nTim Hartling\n\n### Submission Type\n\nPitch — I'd like feedback before writing\n\n### Description\n\nBuild a PowerShell project from many files into one script with PSScriptBuilder. It orders classes and functions by dependency, maps errors and Pester coverage back to your sources, and automates releases.\n\n### Category\n\nTools\n\n### Tags (optional)\n\nclasses, build, modules, pester, release\n\n### Summary / Pitch\n\nPowerShell requires base classes, enums, and the classes that reference them to appear in a valid order. In a multi-file project this ordering is easy to break and hard to maintain by hand. Many teams end up with numbered file names or a hand-written concatenation script.\n\nI maintain PSScriptBuilder, an MIT-licensed module on the PowerShell Gallery that runs on Windows PowerShell 5.1 and PowerShell 7+ (Windows, Linux, macOS). It analyzes your source files with the PowerShell AST, resolves the dependencies, and writes a single, correctly ordered script or module file.\n\nThe article would walk through one small but realistic project and cover:\n\n1. The problem. A project where file order matters, and what breaks when it is wrong.\n2. Automatic ordering. How dependencies (inheritance, type references, inter-file relationships) are resolved from an AST analysis with a topological sort. Fatal cycles (inheritance, static initializers) fail the build before any output is written. When classes and functions depend on each other, the build detects this automatically and the template uses a single ordered placeholder.\n3. Configurable output. Collectors for classes, functions, enums, using statements, and raw files, plus plain-text templates with token placeholders, so the output format is up to you.\n4. Debugging the built output. With -WriteSourceMap, a .sourcemap.json sidecar maps output line numbers, ErrorRecord line numbers, and Pester code coverage back to the source files.\n5. Everything around the build. Project scaffolding, a watch mode that rebuilds on change, optional post-build compression, and release management (SemVer bumping, Git metadata, file updates).\n\nThe article will also state the limits openly: the analysis is static, so dependencies that only exist at runtime (for example New-Object with a string type name) are not detected.\n\nEvery code sample will be run before submission. Readers should leave with a working project they can build, and a clear idea of whether this approach fits their own projects.\n\nI am happy to deliver a full Markdown draft after feedback, or to narrow the scope to a shorter tutorial if that fits the site better.\n\nOne question before I start writing: under which license are guest articles and the code samples in them published on PowerShell.org (the footer shows CC BY-SA 4.0)? My own project is MIT-licensed, and I'd like the samples to stay compatible with that.\n\nThanks for taking a look!\n\n### Article Content (Markdown)\n\n```markdown\n\n```\n\n### Author Website or Social Link (optional)\n\nhttps://github.com/PSScriptBuilder/PSScriptBuilder\n\n### Submission Agreement\n\n- [x] This is my original work and I grant PowerShell.org permission to publish it.\n- [x] I understand the article may be edited for clarity and formatting.","author":{"url":"https://github.com/timhartling","@type":"Person","name":"timhartling"},"datePublished":"2026-10-31T20:50:20Z","url":"https://github.com/PowerShellOrg/PowerShellOrgWebsite/issues/504"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2331d360-773c-d5c2-8103-2b6994c2d01f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 97BA:3C098:54DED:70824:6AFD1B07 |
| html-safe-nonce | df5b062cda5a64380b8727a600585b850cef127f650f5aab8d33b77133fa27c3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5N0JBOjNDMDk4OjU0REVEOjcwODI0OjZBRkQxQjA3IiwidmlzaXRvcl9pZCI6IjYyNTI1MzE4NTk5NDc1OTI0NTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4e7991ca0e58a547c61449927efa636113f601a8cee956b86be0accf784946d9 |
| hovercard-subject-tag | issue:6139618285 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShellOrg/PowerShellOrgWebsite/504/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8e31f85aa261545f19c0f85efe4baf464d793a911392884b6c5f683753b7fc28/PowerShellOrg/PowerShellOrgWebsite/issues/504 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8e31f85aa261545f19c0f85efe4baf464d793a911392884b6c5f683753b7fc28/PowerShellOrg/PowerShellOrgWebsite/issues/504 |
| og:image:alt | Article Title Build one PowerShell script from many files with PSScriptBuilder Author Name Tim Hartling Submission Type Pitch — I'd like feedback before writing Description Build a PowerShell proje... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | timhartling |
| hostname | github.com |
| expected-hostname | github.com |
| None | 065128366c233a9d57ff68ab6c96e25b99dd1b0ab70d23b70873d3dd6b5e4f19 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShellOrg/PowerShellOrgWebsite git https://github.com/PowerShellOrg/PowerShellOrgWebsite.git |
| octolytics-dimension-user_id | 4895314 |
| octolytics-dimension-user_login | PowerShellOrg |
| octolytics-dimension-repository_id | 1050540633 |
| octolytics-dimension-repository_nwo | PowerShellOrg/PowerShellOrgWebsite |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1050540633 |
| octolytics-dimension-repository_network_root_nwo | PowerShellOrg/PowerShellOrgWebsite |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 941021edf0c2ec58298f4a2c8f27ae507d129c92 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width