The step graph

The wizard and the silent CLI run the same graph, built in one place (Hosting/InstallWizardGraph) so they can never drift apart. Steps live in BeepDM; the graph orders them:

PrerequisiteCheckStep      OS / .NET / admin / disk space / custom prereqs
UpgradeStep                detect existing install; refuse downgrade; back up before replacing
DirectoryCreateStep        create the install tree
CustomActionStep(Before)   author's pre-install actions
PayloadDownloadStep        (if PayloadSource=Url) download + extract
PayloadPrepareStep         locate / extract the embedded payload
FileCopyStep               copy component files (per-file progress, rollback-registered)
SharedFileCountStep        SharedDLLs reference counting
Com / Gac steps            register COM servers / install to the GAC
JunctionCreateStep         (side-by-side) link \current at this version
ShortcutCreateStep         Desktop / Start Menu / Startup .lnk (target the launch path)
RegistryWriteStep          HKLM/HKCU entries + Add/Remove Programs
EnvironmentVariableStep    apply + broadcast; reversed on uninstall
CustomActionStep(After)    author's post-install actions
VerifyInstallStep          verify files, write install-manifest.json, register the install
CommitUpgradeStep          discard the upgrade backup only after verification passes

Upgrade, repair & rollback

  • Upgrade — UpgradeStep runs before anything touches disk: fresh install proceeds; same version reinstalls; a newer installed version is refused (with an actionable message naming the version and /FORCE); an upgrade or forced downgrade is backed up first, and aborts if the backup fails. CommitUpgradeStep migrates user config and discards the backup only once verification succeeds — so any failure restores the previous version.
  • Repair (/REPAIR) — RepairFilesStep restores files that are missing or modified (payload-vs-installed), leaving intact files untouched and never inventing or deleting files. Its ComputePlan is pure and unit-tested.
  • Rollback — install runs under a RollbackManager: FileCopyStep registers each file and registry writes register against the hive used; on any failure the host rolls back and restores the pre-upgrade backup.

Locked files & reboots

A locked destination is staged to <dest>.pending and scheduled for a reboot-time swap via MoveFileEx (delay-until-reboot), setting a RebootRequired flag that surfaces as MSI exit code 3010. Unelevated — where the pending-rename registry key can't be written — the step fails with an actionable "in use" message instead of an unhandled exception.

Add/Remove Programs

The synthesized ARP entries expand the %InstallPath% macro (so UninstallString/ModifyPath are runnable), strip stray hive tokens from key paths (InstallScope.NormalizeKeyPath), and — on uninstall — delete the product-owned ARP key outright while removing other touched keys only when empty. Uninstall reverses files, shortcuts, registry, env vars, COM and GAC from the recorded install-manifest.json, then unregisters the install.