Skip to main content
Bach can update an installed app in two ways: a user runs a newer setup file, or the app fetches new versions by itself. Both install the same way. This page explains what happens on the user’s computer, and points to the guides for setting up automatic updates.

Two ways to update

Running a newer setup file. This always works, with nothing to configure. You raise the version, build, and give people the new file. See Ship your first update. Automatic updates. With an [updates] section, the installed app checks a small file on your website or GitHub releases, downloads newer versions in the background and installs them when the app is closed. See Set up automatic updates.

What happens during an update

Setup finds the old installation by the app’s id and updates it in place:
  • It installs into the same folder, even if you’ve changed the default since.
  • It keeps the user’s choices: shortcuts, start with Windows, PATH and components. Options that are new in this version start at their defaults.
  • It adds and replaces files, and removes files that the old version installed but the new one doesn’t have.
  • It doesn’t touch user data or files your app created.
  • A file the user changed after install is kept if the new version no longer ships it.
If the app is running, the window offers Close and continue. Bach asks the app to close the way Windows does when it shuts down, so the app can ask to save first. It doesn’t force it to quit. A silent update stops with exit code 1 instead.

If an update fails

Updates are all or nothing. Setup first unpacks every new file next to the old one, then swaps them all in. If a file is locked, the disk is full, or a later step such as a run step fails, the old files, the old uninstaller and the old shortcuts are put back, and the version under Settings › Apps doesn’t change. What a program you ran already did on its own, such as changing a database, isn’t undone. If the computer loses power in the middle, setup keeps a small journal in the install folder. The next setup, update or uninstall first puts the old files back.

Older versions

Running an older setup file over a newer installation shows a warning, and the user has to choose Install anyway. A silent install refuses, unless you add --allow-downgrade. Automatic updates never go back to an older version.

What automatic updates need from you

With each release you publish two files to a place with a fixed address:
  1. the setup file
  2. latest.json, the update feed: a small file that says which version is newest, where to download it and what its checksum is
bach build writes both when [updates] is configured. With GitHub releases, one release workflow does the publishing for you. Any web host that can serve two files over https works too. See Where to host updates.