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,
PATHand 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 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:- the setup file
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.
Related guides
- Set up automatic updates
- Where to host updates
- Protect your updates: signed feeds and signed files
- Patches and staged rollouts: smaller downloads and gradual releases
- Automatic updates not working?