DEV Community

Cover image for One bach.toml, one Setup.exe: Windows installers without an installer script
leifiyo
leifiyo

Posted on AI-assisted

One bach.toml, one Setup.exe: Windows installers without an installer script

Shipping a desktop app to Windows tends to end the same way: you pick NSIS, Inno Setup or WiX, and then you learn a scripting language or an XML schema to get a setup file out of the door.

I built Bach because making a Windows installer shouldn't need a script language or a compiler. It covers the common case, an app that installs for one user, with settings instead of code.

What it looks like

This is the whole config for a Rust app:

[app]
name = "Hello"
version = "1.0.0"
publisher = "Hello Inc."
executable = "hello.exe"

[files]
source = "target/release"
exclude = ["*.pdb", "deps/**", "build/**"]
Enter fullscreen mode Exit fullscreen mode
$ bach build
Wrote dist\Hello-Setup-1.0.0.exe (9.7 MB)
  Packed       101.8 KB of 216.5 KB (47%), in 0.9s
Enter fullscreen mode Exit fullscreen mode

source is the folder your build writes to. Bach packs it, plus the config, into one Setup.exe.

What the setup file does

  • No admin prompt. Apps install per user into %LOCALAPPDATA%\Programs and only write to the user's own folders and HKCU.
  • Updates that can't half-fail. A newer setup file over an install updates it in place. Files are unpacked first and swapped in together; if one is locked, everything is put back. Files the new version no longer ships are removed.
  • A window people can read. 13 languages that follow the Windows display language, light and dark mode, and every text can be replaced.
  • A clean uninstaller in Settings › Apps. It removes only what the installer put there, and deletes user data only if the user asks.
  • Silent installs for automation: Setup.exe /S.

Setup files need no .NET and no Visual C++ runtime.

Try it without installing anything

npm install --global @usebach/cli

bach init      # writes a commented bach.toml
bach check     # validates it, lists every file the installer will carry
bach preview   # opens the real window; nothing is installed
bach build     # writes the setup file
Enter fullscreen mode Exit fullscreen mode

bach init recognizes Rust, Tauri, Electron and .NET projects and fills in the config. On GitHub it also adds a one-click release workflow, and there is a GitHub Action if you'd rather build in CI. bach itself runs on Windows, macOS and Linux, so the installer can come out of any runner.

When not to use it

Bach does not do machine-wide installs or anything that needs administrator rights, MSI for Group Policy, Windows services or drivers, or custom install-time scripts. It has no delta updates (Velopack does those), and a setup file adds about 10 MB to your app. If you need any of that, NSIS, Inno Setup and WiX are still the right tools.

Links

If something is missing for your kind of app, open an issue. I'd like to hear it.

Top comments (0)