Skip to main content

Adventures in building an Electron app on Windows

I've been working on a new version of the Numbas lockdown browser app.

It's a very basic Electron app: the point is to provide a web browser with none of the developer tools that would let a student fiddle with the internals of a Numbas exam.

Packaging it up has been a nightmare!

For Windows, we need to produce a .msi file for our IT people to install automatically on cluster PCs.

The electron-builder documentation seems comprehensive, but it's extremely hard to read. It took me ages to work out whether and how certain things could be configured.

At least now I know a little bit more about how .msi files work!

Our IT person said that the app automatically launches after installation, which he doesn't want to happen.

I couldn't find an option for that in the configuration documentation, so I decided to look inside the .msi file to see how it's defined, then trace things backwards to a configuration option.

I installed the msitools package on Ubuntu, then ran msiinfo tables Numbas-lockdown.msi to see what's inside.

The InstallExecuteSequence table turns out to contain a list of things that happen during installation.

There's a runAfterFinish option which seems to be what I want.

I traced that back through the source code of electron-builder, and eventually found out that in the build.msi object in my project's package.json, I can set runAfterFinish: false.