This quickstart is the practical entrypoint for the DotNet publish engine.
New-DotNetPublishConfig- scaffolds a JSON config file on disk.
Invoke-DotNetPublish- validates, plans, runs, or exports config.
Import-ConfigurationDotNetPublish- loads a typed JSON specification for use in
Invoke-DotNetPublish -Settings { ... }, preserving bundles, hooks, Store packages, and signing profiles.
- loads a typed JSON specification for use in
New-ConfigurationDotNet*- creates DSL objects used inside
-Settings { ... }.
- creates DSL objects used inside
This keeps responsibilities clear and avoids command mix-ups.
For final package and runtime checks after building, see Validate release artifacts.
Signed portable ZIPs contain application files only. PowerForge writes their publisher-signed inventory beside the ZIP as <archive>.release-inventory.json and <archive>.release-inventory.p7s, records both in the manifest and checksum catalog, and stages them as release metadata. Keep these files with the ZIP when verifying a downloaded release. MSI and native installer staging excludes publisher-owned evidence from the installed application. The verifier also accepts embedded inventory in previously published ZIPs.
With the default UseStaging=true, checksums cover files deployed from the clean publish staging directory, generated service-package files, and release evidence. Files already present only in the destination, such as service logs, databases, and stale binaries, are excluded. A missing deployed checksum input fails the publish. Each publish removes its own temporary staging directory after its last use, including when publishing fails; cleanup failures produce a warning without replacing the publish error. The artifact's PublishDir records that temporary path, while OutputDir contains the retained payload. When UseStaging=false, the output directory itself defines the publish payload and remains in place; use staging for updates into a service directory that also contains runtime data. ZIP creation continues to package its configured output directory.
- Scaffold config:
New-DotNetPublishConfig -ProjectRoot '.' -PassThru-
Open and edit
powerforge.dotnetpublish.json. -
Validate plan only:
Invoke-DotNetPublish -ConfigPath '.\powerforge.dotnetpublish.json' -Validate
Invoke-DotNetPublish -ConfigPath '.\powerforge.dotnetpublish.json' -Plan- Run publish:
Invoke-DotNetPublish -ConfigPath '.\powerforge.dotnetpublish.json' -ExitCodeInteractive runs use the same live progress view and step ledger as module and package builds. The ledger preserves completed work and marks later steps skipped after a failure. Publish rows identify each step's selected framework, runtime, and style.
Use -NoInteractive for plain console logging, or -Quiet to suppress progress and informational output while retaining result objects, warnings and errors. Both options preserve the build workflow. Warnings use the PowerShell warning stream, so -WarningVariable, -WarningAction SilentlyContinue and -WarningAction Stop work in every display mode.
Failures write PowerShell errors in every display mode. Use -ErrorAction Stop when subsequent script statements must not run after failure. -ExitCode instead returns the result without an error record, sets the PowerShell host exit status to 0 or 1, and permits subsequent statements. Configuration and preparation failures follow the same rule.
Use overrides for local/CI experiments while keeping base JSON stable:
Invoke-DotNetPublish `
-ConfigPath '.\powerforge.dotnetpublish.json' `
-Target 'service' `
-Runtimes 'win-x64' `
-Frameworks 'net10.0-windows' `
-Styles PortableCompat `
-SkipRestore `
-SkipBuild `
-ExitCodeCLI overrides are applied before profile resolution. When a profile is active, -Target, -Runtimes, -Frameworks, and -Styles constrain the active profile and matching targets so the exported/plan view reflects the same inputs the runner executes.
Invoke-DotNetPublish -Plan -Settings {
New-ConfigurationDotNetPublish -IncludeSchema -ProjectRoot '.' -Configuration 'Release'
New-ConfigurationDotNetProject -Id 'service' -Path 'src/Service/Service.csproj'
New-ConfigurationDotNetTarget -Name 'service' -ProjectId 'service' -Framework 'net10.0-windows' -Runtimes 'win-x64' -Style PortableCompat -Zip
}Use this when config composition is dynamic or generated by build scripts.
- Scaffold:
powerforge dotnet scaffold --project-root . --output json- Publish:
powerforge dotnet publish --config .\powerforge.dotnetpublish.json --plan
powerforge dotnet publish --config .\powerforge.dotnetpublish.json --output jsonDepending on config, the run can emit:
- published output folders
- zip artifacts
- service scripts (
Install-Service.ps1,Uninstall-Service.ps1,Run-Once.ps1) - MSI prepare/build outputs
- Microsoft Store / MSIX package outputs (
*.msix,*.msixbundle,*.msixupload,*.appxsym) - benchmark gate results
- manifests and checksums (for example
manifest.json,manifest.txt, andSHA256SUMS.txt)
manifest.json is an array of produced outputs with readable string values for fields such as Category, Kind, and Style. Publish and bundle outputs keep their existing entries; MSI and Store/MSIX outputs are also listed as Installer / StorePackage categories with OutputFiles pointing at the final files relative to the project root. manifest.txt mirrors those final MSI and Store package paths for quick operator inspection.
Portable/PortableCompat/PortableSize: self-contained outputs for machines without a preinstalled runtime.FrameworkDependent: smaller outputs that require the matching .NET runtime on the target machine.AotSpeed/AotSize: NativeAOT outputs when the target project/runtime combination supports it.
- Use
Publish.MsBuildPropertiesfor target-wide publish properties. - Use
Publish.StyleOverrides.<Style>.MsBuildPropertieswhen a property should apply only to one publish style. - Style-specific properties override target-level properties, which override global
DotNet.MsBuildProperties.
- Use top-level
SigningProfileswhen multiple targets/installers should share the same signing setup. - Use
Publish.SignProfileorInstallers[].SignProfileto reference a named profile. - Use
SignOverrideswhen you want small per-target tweaks on top of a shared profile, for example only changing the description. - Direct
Signstill works and takes precedence when you want one target to fully define its own signing behavior. - Signing uses
TimeoutSecondsper file, defaulting to 300 seconds, so a stucksigntool.exefollowsOnSignFailureinstead of hanging the publish run.
Normal signed publishing builds the selected working tree, including uncommitted changes. It records Git revision and dirty state as context and verifies the produced files, signatures, and checksums. A dirty checkout does not block signing, and a clean Git status does not claim that every compiler input was tracked. Normal mode runs the build phase of dotnet publish even when DotNet.NoBuildInPublish is true, rather than relying solely on prebuilt files from bin or obj. If a release specifically requires controlled-checkout input proof and no-build publishing, set DotNet.UseControlledSourceProvenance to true in the JSON config. This advanced mode is disabled by default.
- Use
Installers[].Runtimes,Installers[].Frameworks, andInstallers[].Styleswhen an installer should be built only from specific publish combinations. - PowerForge validates that each installer matches at least one publish combination for its
PrepareFromTarget. - This is the recommended way to build only the portable/self-contained MSI while still allowing framework-dependent zip outputs for the same target.
- Use
Bundles[]when the shipped artifact is more than one publish output folder. PrepareFromTargetselects the primary published target for the bundle.PrimarySubdirectoryoptionally places that primary publish output under a folder such asServiceinstead of copying it into the bundle root.Includes[]let you copy sidecar targets such as services, workers, helper CLIs, or plugin payloads into subdirectories inside the bundle.CopyItems[]copies non-publish files or directories such as README files, static scripts, licenses, or product data into the bundle.ModuleIncludes[]copies built PowerShell module artefacts into the bundle, defaulting toModules/{moduleName}so apps can ship their companion module without scraping user-profile installs.GeneratedScripts[]renders inline or file-based script templates into the bundle. Template values use{{TokenName}}; token values can use bundle tokens such as{output},{rid},{framework}, and{moduleName}for module includes.- Bundle paths and token values use single braces such as
{output}. Generated script template bodies use double braces such as{{ModuleName}};GeneratedScripts[].Tokensbridges the two by resolving single-brace values first and then making them available to the double-brace template renderer. Token values are inserted literally; a value containing{{OtherToken}}is not rendered a second time. GeneratedScripts[].Overwrite=falsemeans "fail if the target file already exists", not "skip if present".CopyItems[].ClearDestination=falseandModuleIncludes[].ClearDestination=falselikewise preserve existing destinations by failing on copy conflicts.Scripts[]let you run repo-specific finishing steps after the copy phase, for example exporting plugins, writing launchers, or producing metadata files.PostProcess.ArchiveDirectories[]can zip bundle subdirectories after composition, which is useful for plugin packs or other nested payloads that should ship as archives.PostProcess.DeletePatterns[]removes files or folders from the composed bundle using wildcard patterns such as**/*.pdbor**/createdump.exe.PostProcess.SignProfile/PostProcess.Signsigns files in the composed bundle before zip creation. UsePostProcess.SignPatterns[]for scripts and other bundle payloads, for example**/*.exe,**/*.dll,**/*.ps1,**/*.psm1, and**/*.psd1.PostProcess.Metadatawrites a JSON manifest from standard bundle properties plus templated custom values.- The same reusable post-process contract is also available outside the full publish pipeline through
powerforge dotnet bundle-postprocessandInvoke-PowerForgeBundlePostProcess. - Standalone bundle post-process is useful when a repo keeps a thin PowerShell wrapper for product-specific launcher/readme generation but wants archive/delete/metadata mechanics to stay in PowerForge.
- Set
Zip,ZipPath, orZipNameTemplateon the bundle when the composed folder should also become a release-ready archive.
- Use
powerforge.plugins.jsonwhen several plugin projects need one reusable catalog for folder export and NuGet package builds. powerforge plugin exportandInvoke-PowerForgePluginExportpublish selected plugin groups into folder-style plugin payloads.powerforge plugin packandInvoke-PowerForgePluginPackpack selected plugin groups as NuGet packages and can optionally push the packages produced by the current run.- Plugin entries can define groups, project path, preferred framework, package/assembly names, MSBuild properties, and optional schema-neutral manifest output.
- Keep branded product policy in repo config. For example, use
Manifest.FileNameandManifest.Propertiesforix-plugin.jsonor similar product-specific manifest shapes instead of hardcoding those names into PowerForge. - Example config and commands live in
Module/Examples/PluginCatalog. - For app bundles, prefer a bundle
Scripts[]step that runs plugin export into a plugin subdirectory, then usePostProcess.ArchiveDirectories[]when those plugin folders should be zipped before the final bundle archive.
- Use
Hooks[]for reusable command steps that must run at predictable publish phases rather than in bespoke wrapper scripts. - Supported phases are
BeforeRestore,BeforeBuild,BeforeTargetPublish,AfterTargetPublish,BeforeBundle, andAfterBundle. - Hooks support target/runtime/framework/style filters, arguments, working directory, environment variables, timeout, and required/optional failure policy.
- Hook arguments and environment values support tokens such as
{projectRoot},{configuration},{target},{rid},{framework},{style},{bundle},{phase}, and{hook}. - Hook timeout defaults to 600 seconds when omitted or set to
0; setTimeoutSecondslower for quick local validation hooks or higher for intentionally long-running packaging steps. BeforeBundleandAfterBundlehooks run once per generated bundle step. A bundle that matches multiple target/runtime/framework/style combinations will invoke matching bundle hooks once for each produced bundle artifact.- Use
BeforeBuildorBeforeTargetPublishfor generated-source/catalog refreshes, andBeforeBundleorAfterBundlefor product-specific package finishing that should stay repo-owned.
- Use
PrepareFromBundleIdon an installer when WiX harvesting should run against the composed portable bundle instead of the rawPrepareFromTargetpublish folder. - This is the right pattern for desktop apps that need sidecars, plugins, helper scripts, or metadata to be present in the installer payload.
- Keep
PrepareFromTargetset as well; it remains the source combination that installer filters validate against. HarvestExcludePatterns[]accepts relative wildcard paths such as**/*.pdband basename globs such ascreatedump.exe; basename globs apply anywhere under the harvested payload.
- Use
Installers[].Authoringwhen the installer should be generated from the DotNet publish config instead of a hand-authored*.wixproj. - Leave
InstallerProjectPathandInstallerProjectIdempty;msi.buildwritesProduct.wxsplus a WiX SDK project under the MSI prepare artifact directory, next toprepare.manifest.json, ingenerated/. - Generated MSI builds place the final
.msiin the siblingoutput/directory, and that final file is listed inmanifest.json,manifest.txt, andSHA256SUMS.txt. - PowerForge keeps generated authoring files in the configured prepare artifact directory for inspection, then builds that generated WiX project from a transient short workspace under the system temp directory. This avoids WiX/MSI path-length failures on deep repo and artifact paths while preserving the configured final output path.
- Use
Harvest: AutowithAuthoring.PayloadComponentGroupIdto include the prepared publish payload in the generated MSI feature. - Component entries require a
Typediscriminator:File,Folder,RemoveFolder,Service,RegistryValue, orShortcut. - Installer inputs can set
Required: true; generated dialogs blockNextuntil text/license/path inputs have a value, or until required checkbox properties are non-empty. Required prompts list the required field labels for the current dialog.RequiredMessageis only used when the dialog contains exactly one required input; dialogs with multiple required inputs continue to show the label list. Required radio-group and combo-box inputs must setDefaultValueto one of their choices. Kind: ComboBoxrenders a WiX drop-down fromChoices; use it for presets such as configuration profile, database mode, or environment.LicenseAgreementpoints at an RTF license file and emits the WiX UI license variable for generated installers.- Dialog
Actions[]render command buttons on generated dialogs and open shell targets such ashttps://...configuration/studio pages. ExitLaunchrenders the final-page checkbox action, for example opening a service configuration website after install.- Installer inputs can define validation metadata (
MinLength,MaxLength,ValidationPattern,ValidationMessage) for text, password, path, and license-key inputs. Generated authoring validates metadata shape and authored default values before writing the.wxs; runtime UI enforcement beyondRequiredis reserved for the follow-up validation layer. - Generated authoring validates WiX identifiers, product upgrade GUIDs, and uppercase public MSI property names for installer inputs before writing the
.wxsfile. WiX identifiers must be 72 characters or fewer. - Registry value components can write a literal
Value, or write an installer property by settingValueProperty, for example persistingLICENSE_KEYafter the UI collects it. - Shortcut components can use
TargetFileIdfor an explicitly authored file component, orTargetsuch as[INSTALLFOLDER]MyApp.exewhen the executable comes from harvested payload. - WiX still does the compile. The generated project includes
WixToolset.UI.wixextandWixToolset.Util.wixextonly when the authoring model needs those extensions. Installers[].Versioning.Patterndefaults toFixedMajorMinorDatePatch. UseUtcShortYearMonthDayMinutewhen an MSI line must keep a calendar-basedyy.month.dayMinuteproduct-version sequence for major-upgrade compatibility with older installer scripts.- Monotonic version state and version-bearing output names are immutable by default.
Versioning.Authority: LocalFilecoordinates publishers only when every process sees the sameStatePath. Release builds that can run from separate clones should useVersioning.Authority: GitTags, a stableAuthorityKey, and a sharedGitRemote. PowerForge reads the immutable tag ledger while planning and atomically createsrefs/tags/powerforge-msi/<authority-key>/<version>before publishing. A concurrent clone attempting the same version loses the Git ref race and must re-plan, so the same MSI identity cannot be issued twice. GitTagsdelegates authentication to the normal Git credential flow and deliberately consumes a version even if the later build fails. This keeps failed or uncertain release identities from being reused. It cannot be combined withAllowOutputOverwrite.- Protect
refs/tags/powerforge-msi/**from deletion and force updates with repository rules. Removing or rewriting authority tags destroys the durable version history that separate publishers rely on. - Set
Installers[].Versioning.AllowOutputOverwrite: trueonly for an intentional non-release rebuild using the local-file authority: PowerForge reuses the latest completed version when the configured line and floor still match, serializes competing rebuilds, and releases the state reservation when the run finishes. A newer date floor or major/minor line still advances to a new version. If an installer publishes multiple target/framework/runtime/style combinations, include the relevant combination tokens inVersioning.StatePathorVersioning.AuthorityKey; PowerForge rejects a shared overwrite identity because it cannot authoritatively identify every completed output version.
- Use
StorePackages[]when the repo needs first-class Store/MSIX outputs in the same publish workflow as zip, bundle, or MSI artifacts. PrepareFromTargetkeeps Store packaging aligned with the same runtime/framework/style matrix as the published app target.PackagingProjectPathorPackagingProjectIdpoints at the packaging project, typically a*.wapproj.*.wapprojStore builds automatically prefer Visual Studio / Build ToolsMSBuild.exewhen available, because Windows Application Packaging projects are not reliably handled by plaindotnet build.OutputPathcontrols where generated*.msix,*.msixbundle,*.msixupload, and symbol files land.BuildModeselects Store-upload vs sideload packaging behavior.BundlecontrolsAppxBundlemode (Auto,Always,Never).GenerateAppInstallermaps toGenerateAppInstallerFilefor packaging projects that support it.AppInstalleris the typed side-load/update contract. When enabled, PowerForge requests an.appinstallerfile, records it in Store package outputs, and normalizes generated XML to the configured schema/update settings.- Use
AppInstaller.SchemaVersion: "2021"when settingShowPrompt,UpdateBlocksActivation, orUpdateUris; those settings require the newer App Installer schema on current Windows. AppInstaller.HoursBetweenUpdateChecksmaps to the on-launch update interval and is validated to the documented0..255hour range.UpdateBlocksActivationrequiresShowPrompt: true.- PowerForge forwards the selected publish style into packaging builds through
SelfContained/WindowsAppSDKSelfContained, soFrameworkDependentversusPortableCompatremains meaningful for Store packages too. - Use
MsBuildPropertiesfor project-specific Store settings that are still too repo-specific to deserve a first-class contract.
Use powerforge release prepare-scoop to prepare a portable Windows application's manifest from existing release archives. The release configuration supplies its product metadata under Scoop:
{
"GitHub": { "Owner": "Contoso", "Repository": "Tools", "TagTemplate": "Studio-v{Version}" },
"Scoop": {
"Name": "contoso-studio",
"Description": "Local document workspace",
"Homepage": "https://example.com/studio/",
"License": "MIT",
"Executable": "Studio.exe",
"ShortcutName": "Contoso Studio",
"Target": "Studio.Windows",
"Runtimes": [ "win-x64", "win-arm64" ],
"UrlTemplate": "https://github.com/Contoso/Tools/releases/download/Studio-v$version/Studio-$version-{Runtime}.zip"
}
}powerforge release prepare-scoop --config ./powerforge.release.json `
--manifest ./downloads/release-manifest.json --checksums ./downloads/SHA256SUMS.txt `
--asset-root ./downloads --out ./scoopDownload the selected portable ZIPs, release manifest and checksum catalog into one directory. The catalog must include the manifest's own checksum. Each configured runtime selects exactly one Tool ZIP for the named target; all selected archives must have the same three-part version. PowerForge verifies their downloaded bytes and executable entries, then writes <Name>.json into a new output directory. Archive URLs must resolve to the selected filenames.
The manifest supplies architecture-specific URLs and hashes, a Start menu shortcut, and Scoop checkver/autoupdate definitions. Update detection considers the first 100 GitHub releases, filters drafts and prereleases, and matches GitHub.TagTemplate before extracting the app version. A shared repository's other product releases do not become updates. No matching application release produces no detected update; publish sufficiently frequent application releases or maintain a dedicated release repository when that listing window is insufficient.
Preparation is local: it does not build, sign, reserve versions, download remote archives, publish a bucket, or submit to Scoop Extras. Verify publisher signatures, real install/update/uninstall behavior and application-data retention separately. Scoop's bucket maintainers own acceptance and subsequent automated manifest updates.
For routine WinGet and MSI Store updates, use the catalog update profile and reusable workflow. It maps immutable public Store downloads, verifies their bytes, preflights both channels and preserves independent submission receipts. The lower-level preparation and Store commands below remain useful when integrating another release operator.
For an existing signed MSI release, prepare catalog inputs from downloaded release assets without rebuilding or reserving another version. Run this on Windows:
powerforge release prepare-catalog --config ./powerforge.release.json `
--manifest ./downloads/release-manifest.json --checksums ./downloads/SHA256SUMS.txt `
--asset-root ./downloads --out ./catalog
winget validate ./catalog/Winget/Contoso.App/1.2.3
wingetcreate submit ./catalog/Winget/Contoso.App/1.2.3The release config supplies one enabled Winget.Packages entry with MSI installer
selectors. The manifest uses PowerForge release schema version 1. Preparation
verifies the manifest and installer checksums, Windows Authenticode trust, MSI
name, version and architecture, and writes three WinGet manifests plus
desktop-packages.json. MSI ProductCode, UpgradeCode and fixed machine scope
come from the selected packages. The output directory must be new. Installer
URLs must resolve to immutable, public HTTPS downloads of those same bytes;
preparation does not test remote availability, embedded payload signatures or
installation behavior. Qualify those separately before submission.
For a DesktopInstaller Store target, set DesktopPackagesPath to that generated
JSON array instead of copying package URLs and switches into the submission
config. The path is relative to the Store config file. Defining both
DesktopPackages and DesktopPackagesPath is rejected. Generated MSI entries
specify /qn /norestart for silent installation.
The first Store product reservation and submission, including age ratings,
must be created in Partner Center. Later package updates use the existing
powerforge store submit API path. Desktop installer submissions require the
desktop API scope https://api.store.microsoft.com/.default, seller ID and an
authorized Partner Center application. Keep credentials in environment variables
or the supported secret source. See Microsoft's first-submission requirements.
- Use
powerforge store submitafterStorePackages[]has produced a*.msixuploador*.appxuploadartifact. - Keep Store submission in a separate config file, typically
powerforge.store.submit.jsonorBuild/store.submit.json. - Prefer
ManifestPath+ManifestRootfor app packages so the submit step selects the artifact recorded by the DotNetPublish manifest instead of hardcoding the generated Store output directory. - Use
StorePackageId,SourceTarget,Runtime,Framework, andStyleto select one Store package entry from the manifest. WithoutPackagePatterns, PowerForge prefers*.msixupload/*.appxuploadfiles over raw bundles. Provider: PackagedApptargets the classic packaged-app submission flow:- create or reuse a draft submission
- update
applicationPackages - upload a ZIP archive to the Partner Center SAS URL
- commit the draft
- optionally poll until the draft leaves
CommitStarted
Provider: DesktopInstallertargets the newer MSI/EXE submission API:- update draft package metadata under
/submission/v1/product/{productId}/packages - commit package metadata
- poll draft readiness
- create the submission
- poll publishing status (
INPROGRESS,PUBLISHED,FAILED)
- update draft package metadata under
- For app packages, PowerForge only sets the fields Microsoft documents as required in the update payload:
fileName,fileStatus,minimumDirectXVersion, andminimumSystemRam. - Authentication supports either:
- a direct access token, or
- Azure AD client credentials for
https://manage.devcenter.microsoft.com - for desktop submissions,
Authentication.SellerIdis also required
Useful inspection commands:
powerforge store submit --config .\powerforge.store.submit.json --list
powerforge store submit --config .\powerforge.store.submit.json --target PowerForgeStudio --list-assetsExample:
powerforge store submit --config .\powerforge.store.submit.json --target PowerForgeStudio --plan
powerforge store submit --config .\powerforge.store.submit.json --target PowerForgeStudioReady-to-adapt templates are available in:
Module/Examples/DotNetPublish/Example.ServiceMsi.jsonModule/Examples/DotNetPublish/Example.PortableBundleMsi.jsonModule/Examples/DotNetPublish/Example.StorePackage.jsonModule/Examples/DotNetPublish/Example.StoreSubmit.jsonModule/Examples/DotNetPublish/Example.StoreDesktopSubmit.jsonModule/Examples/DotNetPublish/Example.RebuildState.jsonModule/Examples/DotNetPublish/README.md
For service/installer-heavy repos:
- start by expressing publish/sign/package steps in JSON,
- then add service/MSI/state primitives,
- only replace legacy script logic after parity is validated.
Use the notice generator when packaging a native or managed binary outside the regular MacApp packager:
powerforge dotnet notices --project-root <repository> --deps-json <published.deps.json> --manifest <reviewed-notices.json> --out <license-directory> --output json
It validates every runtime package version against reviewed license text hashes and writes THIRD_PARTY_NOTICES.txt plus runtime-package-inventory.json. Keep each runtime's dependency graph with its build evidence; missing coverage or changed license bytes stop packaging.