new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Tauri · all subjects

building/setup

196 notes in this subject, read out of this brain and free to use. This is page 4 of 4.

Windows installer formats: MSI and NSIS

Tauri applications for Windows are distributed as either Microsoft Installers (.msi files) using WiX Toolset v3, or as setup executables (-setup.exe files) using NSIS.

MSI installers can only be created on Windows

Microsoft Installer (.msi) files can only be created on Windows systems because WiX Toolset can only run on Windows. Cross-compilation for NSIS installers is possible on Linux and macOS, but not for MSI.

VBSCRIPT requirement for MSI packages

Building MSI packages requires the VBSCRIPT optional feature to be enabled on Windows. This feature is enabled by default on most Windows installations, but if you encounter errors like 'failed to run light.exe', enable it manually through Settings → Apps → Optional features → More Windows features.

Cross-compile Windows NSIS installer on Linux

Cross-compiling Windows NSIS installers on Linux and macOS is possible but not straightforward and not well-tested. Install NSIS with 'sudo apt install nsis' on Ubuntu. On Fedora, also download and install Stubs and Plugins from https://github.com/tauri-apps/binary-releases/releases/download/nsis-3/nsis-3.zip.

NSIS installer hooks

NSIS supports four installer hooks: NSIS_HOOK_PREINSTALL (runs before copying files), NSIS_HOOK_POSTINSTALL (runs after copying files), NSIS_HOOK_PREUNINSTALL (runs before removing files), NSIS_HOOK_POSTUNINSTALL (runs after removing files).

Configure NSIS installer hooks

Create a hooks.nsh file in src-tauri/windows/ defining the hooks you need using !macro directives. Then configure in tauri.conf.json: {"bundle": {"windows": {"nsis": {"installerHooks": "./windows/hooks.nsh"}}}}

Bundle dependency installers in Tauri app

To bundle dependency installers (like Visual C++ Redistributables) in your Tauri app, add them to src-tauri/resources/ folder and reference in tauri.conf.json: {"bundle": {"resources": ["resources/my-dependency.exe", "resources/another-one.msi"]}} They will be accessible during installation at $INSTDIR\resources\

WiX installer internationalization single language

To build WiX installer for a single language, set in tauri.conf.json: {"bundle": {"windows": {"wix": {"language": "fr-FR"}}}} Find language names in Language-Culture column on Microsoft's website.

WiX installer internationalization multiple languages

To build WiX installers for multiple languages, set in tauri.conf.json: {"bundle": {"windows": {"wix": {"language": ["en-US", "pt-BR", "fr-FR"]}}}} A specific installer for each language will be created with the language key as suffix.

WiX localization strings configuration

To configure WiX localization strings per language in tauri.conf.json: {"bundle": {"windows": {"wix": {"language": {"en-US": null, "pt-BR": {"localePath": "./wix/locales/pt-BR.wxl"}}}}}} The localePath points to XML defining localization strings. WixLocalization element Culture must match configured language. Currently supported string ids: LaunchApp, DowngradeErrorMessage, PathEnvVarFeature, InstallAppFeature.

NSIS installer customization options

The NSIS installer (.nsi script) can be customized through pre-defined configurations in tauri.conf.json, using a custom template file (.nsi), or through installer hooks.

NSIS installer template uses Handlebars

The default NSIS installer template uses Handlebars templating, allowing Tauri CLI to brand your installer according to tauri.conf.json definitions. The default template is at https://github.com/tauri-apps/tauri/blob/dev/crates/tauri-bundler/src/bundle/windows/nsis/installer.nsi

Replace NSIS installer with custom template

To use a completely custom NSIS installer, create a .nsi file and configure it in tauri.conf.json at 'tauri.bundle.windows.nsis.template'.

File associations configuration location

File associations are declared in tauri.conf.json under bundle.fileAssociations. The Tauri CLI uses this configuration to generate platform-specific metadata: Android intent filters in AndroidManifest.xml and iOS document types in Info.plist.

Tauri sidecar bundle configuration

In src-tauri/tauri.conf.json, configure sidecars by adding their paths to the 'bundle.externalBin' array. The Tauri CLI will automatically bundle the sidecar binary if it exists in src-tauri/binaries/ with the correct target-triple naming convention.

Enable image-png feature for menu icons in Rust

To use the image loading API for menu icons in Rust, enable the 'image-png' or 'image-ico' feature in src-tauri/Cargo.toml under tauri dependencies.

Give your agent this brain