win configuration contains options for building Windows targets. These options apply to all Windows target types including NSIS, MSI, AppX, portable, and Squirrel.
Windows Targets Overview
NSIS
Default Windows installer with auto-updates
Portable
Standalone executable without installation
MSI
Windows Installer package format
Base Windows Configuration
Thewin key in your electron-builder configuration applies to all Windows targets:
For detailed Windows configuration options, see the WindowsConfiguration interface reference.
NSIS Installer
NSIS is the default and recommended target for Windows. It supports automatic updates, Unicode, and can build both 32-bit and 64-bit installers.Basic NSIS Configuration
- JSON
- YAML
Assisted Installer (Non One-Click)
For more control over the installation process, use assisted installer mode:- JSON
- YAML
Assisted installer allows users to choose between per-user and per-machine installation, and select the installation directory.
32-bit + 64-bit Support
Building for both architectures creates a single universal installer:Web Installer
Web installer reduces download size by fetching the package files on-demand:Web installer automatically detects OS architecture and downloads the corresponding package. If download fails (antivirus, offline), users can download the package file manually and place it in the same directory as the installer.
Custom NSIS Script
Customize the NSIS installer by creatingbuild/installer.nsh with custom macros:
Available Custom Macros
customHeader- Add custom NSIS header contentpreInit- Execute at the beginning of .OnInit callbackcustomInit- Custom initialization codecustomUnInit- Custom uninstaller initializationcustomInstall- Custom installation stepscustomUnInstall- Custom uninstallation stepscustomRemoveFiles- Custom file removalcustomInstallMode- Force installation modecustomWelcomePage- Customize welcome pagecustomUnWelcomePage- Customize uninstaller welcome pagecustomUnInstallSection- Add custom uninstaller sections
Including Additional Resources
To include additional resources like scripts or MSI installers:Detect Update vs Fresh Install
Available variables:
BUILD_RESOURCES_DIR, PROJECT_DIR, ONE_CLICK, and all other electron-builder flags. The build directory is added as addincludedir and build/x86-unicode, build/x86-ansi as addplugindir.GUID vs Application Name
Windows uses registry keys for install/uninstall info. electron-builder automatically generates a name-based UUID v5 from yourappId or name.
You can explicitly set a GUID using nsis.guid, but using appId is recommended:
Set the Application User Model ID (AUMID) in your main process for proper Windows notifications:
Portable App
Build a portable executable that doesn’t require installation:Portable Environment Variables
These environment variables are available in portable apps:PORTABLE_EXECUTABLE_FILE- Path to the portable executablePORTABLE_EXECUTABLE_DIR- Directory where the portable executable is locatedPORTABLE_EXECUTABLE_APP_FILENAME- Sanitized app name for use in file paths
Code Signing
Delegated Code Signing
Use a custom signing function for delegated code signing:customSign.js in your project root:
The sign function is called multiple times for different files. See why sign.js is called 8 times for details.
Custom Signature Verification
For NSIS updater with custom signature verification:Other Targets
electron-builder supports additional Windows targets:- MSI
- AppX
- Squirrel
Windows Installer package format:
Development Environment Setup
Parallels Windows 10 VM
For building AppX on macOS, Parallels VM is recommended:Download VM
- Open Parallels Desktop
- File → New
- Select “Modern.IE” in “Free Systems”
- Select “Microsoft Edge on Windows 10”
Configure
Important: Disable “Share Mac user folders with Windows” feature. Do not run installers from shared folders.
No Windows 10 license required - free VMs are provided and expire after 90 days, but no additional setup is needed after expiration.
VirtualBox Windows 10 VM
Alternatively, use free VirtualBox:Download
- Visit Download virtual machines
- Select “MSEdge on Win10 (x64) Stable”
- Select “VirtualBox” platform
- Download and follow installation instructions