mcpField
D
distributing-tauri-for-windows

distributing-tauri-for-windows

github.com/dchukDevelopment36232 installsUpdated 40w ago
Repository

About distributing-tauri-for-windows

A Windows distribution guide for Tauri v2 developers, covering MSI and NSIS builds, installer configuration and customization, and Microsoft Store submission.

Key features

  1. 01Build MSI and NSIS installers
  2. 02Configure WebView2 installation modes
  3. 03Customize WiX and NSIS installers
  4. 04Set installer languages
  5. 05Configure code signing and timestamps
  6. 06Prepare Microsoft Store releases

Use cases

  1. 01Package a Tauri app for Windows
  2. 02Build an NSIS installer on Linux or macOS
  3. 03Configure WebView2 for offline or enterprise deployment
  4. 04Prepare a Tauri app for Store submission

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/dchuk/claude-code-tauri-skills --skill distributing-tauri-for-windows

After installing, type/distributing-tauri-for-windowsin Claude Code to confirm it loaded.

Details

From the project README

Distributing Tauri Applications for Windows

This skill covers Windows distribution for Tauri v2 applications, including MSI/NSIS installer creation, customization, and Microsoft Store submission.

Installer Formats Overview

Tauri supports two Windows installer formats:

FormatExtensionBuild PlatformNotes
WiX MSI.msiWindows onlyTraditional Windows installer
NSIS-setup.exeCross-platformCan build on Linux/macOS

Building Installers

Standard Build (Windows)
npm run tauri build
# or
yarn tauri build
# or
pnpm tauri build
# or
cargo tauri build
Target Architectures
# 64-bit (default)
npm run tauri build -- --target x86_64-pc-windows-msvc

# 32-bit
npm run tauri build -- --target i686-pc-windows-msvc

# ARM64 (requires additional VS build tools)
npm run tauri build -- --target aarch64-pc-windows-msvc
Cross-Platform NSIS Build (Linux/macOS)

NSIS installers can be built on non-Windows systems:

Prerequisites (Linux):

# Install NSIS and build tools (Debian/Ubuntu)
sudo apt install nsis lld llvm clang

# Install Windows Rust target
rustup target add x86_64-pc-windows-msvc

# Install cargo-xwin
cargo install --locked cargo-xwin

Prerequisites (macOS):

# Install via Homebrew
brew install nsis llvm

# Add LLVM to PATH
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"

# Install Windows Rust target
rustup target add x86_64-pc-windows-msvc

# Install cargo-xwin
cargo install --locked cargo-xwin

Build command:

npm run tauri build -- --runner cargo-xwin --target x86_64-pc-windows-msvc

WebView2 Installation Modes

Configure how WebView2 runtime is installed on end-user machines:

ModeInternet RequiredSize ImpactBest For
downloadBootstrapperYes0 MBDefault, smallest installer
embedBootstrapperYes~1.8 MBBetter Windows 7 support
offlineInstallerNo~127 MBOffline/air-gapped environments
fixedVersionNo~180 MBControlled enterprise deployment
skipNo0 MBNot recommended
Configuration
{
  "bundle": {
    "windows": {
      "webviewInstallMode": {
        "type": "embedBootstrapper"  // or: downloadBootstrapper, offlineInstaller, fixedVersion
      }
    }
  }
}

For fixedVersion, add the path: "path": "./WebView2Runtime"

WiX MSI Customization

Custom WiX Template

Replace the default template:

{
  "bundle": {
    "windows": {
      "wix": {
        "template": "./windows/custom-template.wxs"
      }
    }
  }
}
WiX Fragments

Add custom functionality via XML fragments:

1. Create fragment file (src-tauri/windows/fragments/registry.wxs):

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Fragment>
    <ComponentGroup Id="MyFragmentRegistryEntries">
      <Component Id="MyRegistryEntry" Directory="INSTALLDIR">
        <RegistryKey Root="HKCU" Key="Software\MyApp">
          <RegistryValue Type="string" Name="InstallPath" Value="[INSTALLDIR]" KeyPath="yes"/>
        </RegistryKey>
      </Component>
    </ComponentGroup>
  </Fragment>
</Wix>

2. Reference in configuration:

{
  "bundle": {
    "windows": {
      "wix": {
        "fragmentPaths": ["./windows/fragments/registry.wxs"],
        "componentRefs": ["MyFragmentRegistryEntries"]
      }
    }
  }
}
Internationalization (WiX)
{
  "bundle": {
    "windows": {
      "wix": {
        "language": ["en-US", "fr-FR", "de-DE"],  // Single: "fr-FR"
        "localePath": "./windows/locales"  // Optional: custom locale files
      }
    }
  }
}

NSIS Installer Customization

Install Modes
ModeAdmin RequiredInstall LocationUse Case
perUserNo%LOCALAPPDATA%Default, no elevation
perMachineYes%PROGRAMFILES%System-wide install
bothYesUser choiceFlexible deployment
{
  "bundle": {
    "windows": {
      "nsis": {
        "installMode": "perMachine"
      }
    }
  }
}
Installer Hooks

Extend installation with custom NSIS scripts:

1. Create hooks file (src-tauri/windows/hooks.nsh):

!macro NSIS_HOOK_PREINSTALL
  ; Run before file installation
  DetailPrint "Preparing installation..."
!macroend

!macro NSIS_HOOK_POSTINSTALL
  ; Run after installation completes
  DetailPrint "Configuring application..."
  ; Example: Install VC++ Redistributable
  ReadRegStr $0 HKLM "SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" "Installed"
  ${If} $0 != "1"
    ExecWait '"$INSTDIR\vc_redist.x64.exe" /quiet /norestart'
  ${EndIf}
!macroend

!macro NSIS_HOOK_PREUNINSTALL
  ; Run before uninstallation
  DetailPrint "Cleaning up..."
!macroend

!macro NSIS_HOOK_POSTUNINSTALL
  ; Run after uninstallation
  DetailPrint "Removal complete"
!macroend

2. Reference in configuration:

{
  "bundle": {
    "windows": {
      "nsis": {
        "installerHooks": "./windows/hooks.nsh"
      }
    }
  }
}
Internationalization (NSIS)

NSIS installers support multiple languages in a single file:

{
  "bundle": {
    "windows": {
      "nsis": {
        "languages": ["English", "French", "German", "Spanish"],
        "displayLanguageSelector": true
      }
    }
  }
}
Minimum WebView2 Version

Require a specific WebView2 version:

{
  "bundle": {
    "windows": {
      "nsis": {
        "minimumWebview2Version": "110.0.1531.0"
      }
    }
  }
}

Complete Configuration Example

{
  "bundle": {
    "active": true,
    "targets": ["msi", "nsis"],
    "icon": ["icons/icon.ico"],
    "windows": {
      "certificateThumbprint": "YOUR_CERTIFICATE_THUMBPRINT",
      "timestampUrl": "http://timestamp.digicert.com",
      "webviewInstallMode": {
        "type": "embedBootstrapper"
      },
      "wix": {
        "language": ["en-US", "de-DE"],
        "fragmentPaths": ["./windows/fragments/registry.wxs"],
        "componentRefs": ["MyRegistryEntries"]
      },
      "nsis": {
        "installMode": "both",
        "installerHooks": "./windows/hooks.nsh",
        "languages": ["English", "German"],
        "displayLanguageSelector": true,
        "minimumWebview2Version": "110.0.1531.0"
      }
    }
  }
}

Special Configurations

Windows 7 Support
{
  "bundle": {
    "windows": {
      "webviewInstallMode": {
        "type": "embedBootstrapper"
      }
    }
  }
}

Enable Windows 7 notification support in Cargo.toml:

[dependencies]
tauri = { version = "2", features = ["windows7-compat"] }
FIPS Compliance

Set environment variable before building:

PowerShell:

$env:TAURI_BUNDLER_WIX_FIPS_COMPLIANT = "true"
npm run tauri build

Command Prompt:

set TAURI_BUNDLER_WIX_FIPS_COMPLIANT=true
npm run tauri build

Microsoft Store Distribution

Requirements
  1. Microsoft account with developer enrollment
  2. Offline installer WebView2 mode (required by Store policy)
  3. Publisher name different from product name
Store-Specific Configuration

Create tauri.microsoftstore.conf.json:

{
  "bundle": {
    "windows": {
      "webviewInstallMode": {
        "type": "offlineInstaller"
      }
    }
  },
  "identifier": "com.yourcompany.yourapp",
  "publisher": "Your Company Name"
}
Generate Store Icons
npm run tauri icon /path/to/app-icon.png

This generates all required icon sizes including Microsoft Store assets.

Build for Store
npm run tauri build -- --config tauri.microsoftstore.conf.json
Submission Process
  1. Build with offline installer configuration
  2. Sign installer with valid code signing certificate
  3. Create app listing in Partner Center (Apps and Games)
  4. Reserve unique app name
  5. Upload installer to distribution service
  6. Link installer URL in Store listing
  7. Submit for certification
Publisher Name Constraint

Your publisher name cannot match your product name. If your bundle identifier is com.myapp.myapp, explicitly set a different publisher:

{
  "identifier": "com.myapp.myapp",
  "publisher": "MyApp Software Inc"
}

Code Signing

Using Certificate Thumbprint
{
  "bundle": {
    "windows": {
      "certificateThumbprint": "YOUR_CERTIFICATE_THUMBPRINT",
      "timestampUrl": "http://timestamp.digicert.com"
    }
  }
}
Environment Variables
# Certificate path
export TAURI_SIGNING_PRIVATE_KEY_PASSWORD="your-password"

# Or via tauri.conf.json
Timestamp Servers

Common timestamp servers:

  • DigiCert: http://timestamp.digicert.com
  • Sectigo: http://timestamp.sectigo.com
  • GlobalSign: http://timestamp.globalsign.com/tsa/r6advanced1

Troubleshooting

MSI Build Fails on Non-Windows

MSI files can only be built on Windows using WiX Toolset. Use NSIS for cross-platform builds.

WebView2 Not Installing
  1. Check webview install mode configuration
  2. Verify internet connectivity for bootstrapper modes
  3. For offline mode, ensure installer size is acceptable
NSIS Cross-Compilation Errors
  1. Verify NSIS is installed and in PATH
  2. Check LLVM/clang installation
  3. Ensure Windows Rust target is installed
  4. Verify cargo-xwin is installed
Certificate Not Found
  1. Verify certificate is installed in Windows certificate store
  2. Check thumbprint matches exactly (no spaces)
  3. Ensure certificate has private key access

Comments

Markdown supported