Skip to content
Carlos Hernandez edited this page Oct 15, 2026 · 3 revisions

MSI

embala builds a Windows Installer database (.msi) directly — no WiX, no Wine, no .NET on the build host. It writes the CFB container, the relational tables, and the embedded MSZIP cabinet itself, so the msi format cross-builds from Linux or macOS the same as from Windows.

The honest part up front: this is a deliberately small MSI. It installs your files under Program Files for all users, drops one Start-menu shortcut, registers in Add/Remove Programs, and uninstalls cleanly. Optionally it registers one Windows service and appends the install directory to the system PATH. It does not paint a wizard or let the user pick a directory. If you need that, the msi format is the wrong tool — build a Setup-Exe instead. The Limitations section lists every corner the format deliberately cuts.

What you get

A single per-machine, 64-bit .msi. Installing it (double-click or msiexec) produces:

Result Detail
Files under Program Files Installed into Program Files\<display-name>\ (the 64-bit ProgramFiles64Folder), preserving your nested dest paths.
One Start-menu shortcut Placed directly in the Start-menu programs list (no app subfolder), labelled display-name, targeting main-executable.
Add/Remove Programs entry Shows up in Settings → Apps / Programs and Features with your name, publisher, version, and description.
Clean uninstall Via Settings, Programs and Features, or msiexec /x. Removes the files, the shortcut, and the ARP entry — no leftovers.
Windows service (optional) With [msi].service, one payload file is registered as a service. See Windows service.
System PATH entry (optional) With add-to-path = true, the install directory is appended to the machine PATH and removed again on uninstall. See PATH.

The install is per-machine (ALLUSERS=1), so it writes to Program Files and requires elevation, exactly like any other system-wide MSI.

This is the entire install-time UI — msiexec's basic progress dialog, captured on Windows 11 (there is no wizard; that's Setup-Exe's job):

msiexec basic progress dialog

Config

Add an [msi] section to embala.toml. The first three fields are required:

Field Type Meaning
arch "x86_64" or "aarch64" Target architecture. No other value parses (32-bit configs are rejected at parse time).
files array of { src, dest } Payload. src is resolved relative to the config file; dest is the /-separated install path under the install directory.
main-executable string The dest the Start-menu shortcut points at. Must equal one of the files dests.
service table Optional. Registers a Windows service; see Windows service.
add-to-path bool Optional, default false. Appends the install directory to the system PATH; see PATH.

The identity that ends up inside the MSI comes from your [package] table, not from [msi]. Here is where each [package] field surfaces:

[package] field Surfaces as Where the user sees it
display-name ProductName ARP display name, install-folder name, shortcut label
version ProductVersion ARP version; drives upgrade detection
publisher Manufacturer ARP "Publisher"
description ARP Comments ARP details / "Comments"
homepage ARP "More information" link ARP details (omitted if unset)
name registry key + artifact file name not user-facing; part of the output name <name>-<version>-<arch>.msi
identifier UpgradeCode / ProductCode seed not user-facing; see Upgrades

homepage is the only optional one — leave it out and the "More information" link simply isn't authored.

Example

[package]
name = "hello"
display-name = "Embala Hello"
version = "0.1.0"
identifier = "ca.hrndz.embala.hello"
publisher = "Carlos Hernandez"
description = "A tiny demo app"
homepage = "https://github.com/hurricanehrndz/embala"

[msi]
arch = "x86_64"
main-executable = "hello.exe"
files = [
  { src = "dist/hello.exe", dest = "hello.exe" },
  { src = "dist/readme.txt", dest = "data/readme.txt" },
]

This installs hello.exe and data\readme.txt under Program Files\Embala Hello\, with a Start-menu shortcut named "Embala Hello" that launches hello.exe.

A few validation rules worth knowing (all enforced at parse or build time):

  • version must be numeric x.y.z — MSI requires it. 0.1.0-beta is rejected (package.version must be numeric x.y.z).
  • identifier must be reverse-DNS-like (com.example.app).
  • name must match [a-z0-9-]+.
  • Every string that lands in the database must be ASCII. A non-ASCII publisher, display-name, etc. fails the build with msi <field> must be ASCII (MSI databases are Windows-1252).
  • Each dest must be a relative /-separated path with no empty or .. segments, and no two files may share a dest.
  • service.name must be 1-256 ASCII characters without /, \, [ or ], and service.executable must match a files dest (msi service executable ... does not match any file dest).

Windows service

service registers one payload file as a Windows service, using the MSI's own ServiceInstall and ServiceControl tables (no custom actions):

[msi]
arch = "x86_64"
main-executable = "hello-ui.exe"
files = [
  { src = "dist/hello-ui.exe", dest = "hello-ui.exe" },
  { src = "dist/hello-agent.exe", dest = "hello-agent.exe" },
]
service = { name = "hello-agent", display-name = "Hello Agent", start = "auto", executable = "hello-agent.exe" }
Field Required / default Meaning
name required Service (SCM key) name: 1-256 ASCII characters, without /, \, [ or ].
start required auto (starts at boot), demand (manual) or disabled.
display-name optional Name shown in the Services console.
description optional Description shown in the Services console.
arguments optional Command-line arguments passed to the service.
executable default main-executable The dest of the payload file the service runs. Must match one of the files dests. Use it when the shortcut opens a UI and a separate agent is the service.

What happens at install time:

  • The service runs in its own process as LocalSystem.
  • Install starts it, unless start = "disabled", and waits for it to come up. If it doesn't start, the install fails and rolls back. Only make it auto or demand if the program really is a service.
  • Upgrades and uninstalls stop it first. Uninstall also removes it.

PATH

add-to-path = true appends the install directory to the system (machine) PATH on install. Uninstall removes only that entry and leaves the rest of PATH as it was. It suits CLI tools that should be callable from any shell. The entry is written by the MSI's Environment table, attached to the main-executable file.

Upgrades

embala derives the MSI GUIDs deterministically from your identifier, so upgrades work without you tracking any codes by hand:

  • The UpgradeCode (the product-line identity) is derived from identifier alone. It is stable across every version you ship.
  • The ProductCode (this specific release) is derived from identifier + version, so it changes each release.

The single rule you must follow: keep identifier stable across releases. As long as it doesn't change, every build shares one UpgradeCode, and Windows treats each new version as an upgrade of the same product.

Installing v2 over v1 is an in-place major upgrade: the installer detects the older version, removes it before laying down the new files (RemoveExistingProducts runs early, right after install validation), and leaves exactly one Add/Remove Programs entry — never two side-by-side.

Downgrades are blocked. If a newer version is already installed, running an older installer refuses with:

A newer version of [ProductName] is already installed.

([ProductName] expands to your display-name.) This is a launch condition, so it fails cleanly up front rather than half-installing.

Because GUIDs are deterministic, builds are also byte-reproducible: the same spec produces the same .msi every time.

Limitations

These are scope decisions, not bugs. The msi format is intentionally the "install my files and give me a clean uninstall" option. It deliberately does not do the following:

Limitation Detail
Per-machine only Always installs for all users into Program Files (ALLUSERS=1). No per-user install mode.
Fixed install directory Always Program Files\<display-name>\. The user cannot choose a different location.
No UI / dialogs No wizard, no license page, no feature tree, no directory picker. You get msiexec's basic progress bar and nothing else — there is no Dialog/Control authoring at all.
Single feature Everything installs as one feature, all-or-nothing. No optional components to select.
Start-menu shortcut only One shortcut, in the Start menu. No desktop shortcut, no quick-launch, no multiple shortcuts.
No registry authoring Writes no application registry keys on your behalf. (One internal HKCU marker exists purely as the shortcut's key-path; it is not for your use.) PATH is the only environment variable it can change.
One service At most one Windows service, running as LocalSystem. No other accounts, recovery actions or dependencies.
ASCII strings only The database is Windows-1252; any non-ASCII metadata fails the build rather than silently mangling.
~2 GiB per-file ceiling Each file's size is a 32-bit field, so a single payload file above ~2 GiB is rejected (msi payload too large).
64-bit x86_64 / aarch64 only No 32-bit target. aarch64 is supported and shipped; x86_64 is verified end-to-end on real Windows, while aarch64 artifacts are cross-compile-tested but not yet verified on ARM64 hardware.

If you want per-user installs, a wizard UI, selectable components, multiple or desktop shortcuts, a license prompt, or registry writes, use the Setup-Exe format instead — that is exactly what it exists for. See Getting-Started for choosing a format and Configuration-Reference for the full config schema.

Silent install / uninstall

The MSI runs fully unattended with standard msiexec flags — nothing embala-specific:

:: Silent install (no UI, all users — run elevated)
msiexec /i hello-0.1.0-x86_64.msi /qn

:: Silent uninstall by package file
msiexec /x hello-0.1.0-x86_64.msi /qn

:: Or uninstall by ProductCode (from Add/Remove Programs)
msiexec /x {PRODUCT-CODE-GUID} /qn

:: Log a troublesome install
msiexec /i hello-0.1.0-x86_64.msi /qn /l*v install.log

Because it's a plain per-machine MSI, it also deploys through Group Policy, SCCM, Intune, and similar fleet tooling with no special handling.

Signing

embala can sign the finished .msi for you — it never implements a signature format, it shells out to the tool you supply. One note specific to MSI: embala's .msi is a CFB v4 file that osslsigncode cannot parse, so use jsign or signtool for the msi format. Full details, tool compatibility, and honest expectations about what signing actually clears are in Code-Signing.

Clone this wiki locally