@choochmeque/tauri-windows-bundle

中文文档
0.2.0发布于 2026/09/16MITTypeScriptES Module构建来源已验证近 30 天下载 9941

MSIX packaging tool for Tauri apps - Windows Store ready bundles

原始使用文档
文档目录32 节
  1. Features
  2. Prerequisites
  3. Bundled msixbundle-cli
  4. Installation
  5. Usage
  6. Initialize
  7. Configure
  8. Build
  9. Output
  10. CLI Reference
  11. Windows Extensions
  12. File Associations
  13. Protocol Handlers
  14. Share Target
  15. Startup Task
  16. Context Menu
  17. Background Task
  18. List Extensions
  19. App Execution Alias
  20. App Service
  21. Toast Activation
  22. Autoplay
  23. Print Task Settings
  24. Thumbnail Handler
  25. Preview Handler
  26. List Extensions
  27. Remove Extension
  28. Code Signing
  29. Option 1: PFX Certificate
  30. Option 2: Windows Certificate Store
  31. GitHub Actions
  32. License

tauri-windows-bundle

npm codecov License

MSIX packaging tool for Tauri apps - create Windows Store ready bundles with multiarch support.

Features

  • MSIX Packaging - Create Store-ready MSIX packages
  • Multiarch Support - Build for x64 and arm64 in one bundle
  • tauri.conf.json Integration - Automatically reads app name, version, icons, and resources
  • Code Signing - Support for PFX certificates and Windows certificate store
  • Resource Indexing - Optional resources.pri generation for qualified assets
  • Windows Extensions - Share Target, File Associations, Protocol Handlers, Startup Task, Context Menus, Background Tasks, App Execution Alias, App Services, Toast Activation, Autoplay, Print Task Settings, Thumbnail/Preview Handlers

Prerequisites

  • Rust with Windows targets
  • Windows SDK (for signing)
# Install Rust targets for multiarch builds
rustup target add x86_64-pc-windows-msvc
rustup target add aarch64-pc-windows-msvc

Bundled msixbundle-cli

On Windows (x64 and arm64) the msixbundle-cli binary is shipped automatically as an optionalDependencies sidecar (@choochmeque/msixbundle-cli-win32) — no separate install is needed.

If you're on macOS or Linux (e.g. cross-compiling), or if you installed with --omit=optional (npm) / --no-optional (pnpm/yarn), the build command falls back to whatever msixbundle-cli is on your PATH and prompts to cargo install msixbundle-cli if it's missing.

Installation

# One-time setup (use @latest to ensure newest version)
npx @choochmeque/tauri-windows-bundle@latest init

# Or install as dev dependency
npm install -D @choochmeque/tauri-windows-bundle

Tip: Use @latest with npx to bypass cached versions: npx @choochmeque/tauri-windows-bundle@latest --version

Usage

Initialize

npx @choochmeque/tauri-windows-bundle init

This creates:

  • src-tauri/gen/windows/bundle.config.json - MSIX-specific configuration
  • src-tauri/gen/windows/AppxManifest.xml.template - Manifest template
  • src-tauri/gen/windows/Assets/ - Icons (copied from src-tauri/icons/ or placeholders)
  • Adds @choochmeque/tauri-windows-bundle as devDependency
  • Adds tauri:windows:build script to package.json

Note: If Tauri icons exist in src-tauri/icons/, they are automatically copied. The wide tile (310x150) is generated by centering the square icon.

Windows-specific icons: Set bundle.icon in tauri.windows.conf.json (or tauri.conf.json) to point at a different folder, and init will derive the asset source from there. For example, with

// tauri.windows.conf.json
{ "bundle": { "icon": ["icons/windows/32x32.png", "icons/windows/icon.ico"] } }

init uses src-tauri/icons/windows/ (the parent dir of the first .png entry, resolved against src-tauri/) as the asset source. Inside that folder it looks for the MSIX-named files Tauri generates via tauri icon:

  • Direct copy: StoreLogo.png, Square44x44Logo.png, Square150x150Logo.png (each missing file becomes a placeholder).
  • Wide tile (Wide310x150Logo.png) is generated from the first square icon found: Square150x150Logo.png → Square142x142Logo.png → icon.png → 128x128.png.
  • Variant source (when --scale / --target-size / --unplated / --light-unplated is set): icon.png → Square310x310Logo.png → 128x128.png.

If bundle.icon has no .png entries, the default src-tauri/icons/ is used.

Icon variants (optional)

Pass one or more flags to init to also generate the suffixed asset variants Windows uses for DPI scaling, taskbar/Start icons, and theme-aware tiles:

npx @choochmeque/tauri-windows-bundle init --all-variants
FlagFiles generated
--scale<asset>.scale-100/125/150/200/400.png for StoreLogo, Square44x44Logo, Square150x150Logo
--target-sizeSquare44x44Logo.targetsize-16/20/24/30/32/36/40/48/60/64/72/80/96/256.png (taskbar, Start list, jump lists)
--unplatedSquare44x44Logo.targetsize-N_altform-unplated.png (transparent background)
--light-unplatedSquare44x44Logo.targetsize-N_altform-lightunplated.png (light theme)
--all-variantsAll of the above

Variants are sourced from the highest-resolution Tauri icon found, in this order: src-tauri/icons/icon.png → Square310x310Logo.png → 128x128.png. If none are present, variant generation is skipped with a warning.

Passing any variant flag also flips resourceIndex.enabled to true in the generated bundle.config.json, because Windows only resolves suffixed assets through a resources.pri file built by --makepri.

Configure

Edit src-tauri/gen/windows/bundle.config.json:

{
  "publisher": "CN=YourCompany",
  "publisherDisplayName": "Your Company Name",
  "capabilities": {
    "general": ["internetClient"]
  },
  "signing": {
    "pfx": null,
    "pfxPassword": null
  },
  "resourceIndex": {
    "enabled": false,
    "keepConfig": false
  }
}

executableName (optional) pins the exe filename when derivation is wrong. Without it the name resolves from mainBinaryName in tauri.conf.json, then the first [[bin]] (else [package]) name in src-tauri/Cargo.toml, and only as a last resort from the product name.

publisher and publisherDisplayName are optional in bundle.config.json. If omitted, publisher falls back to bundle.publisher from tauri.conf.json or tauri.windows.conf.json. If publisherDisplayName is omitted, it defaults to the resolved publisher value.

Capabilities are validated at build time. Three types are supported:

{
  "capabilities": {
    "general": ["internetClient", "internetClientServer", "privateNetworkClientServer"],
    "device": ["webcam", "microphone", "location", "bluetooth"],
    "restricted": ["broadFileSystemAccess", "allowElevation"]
  }
}
  • general - Standard capabilities (<Capability>)
  • device - Device access (<DeviceCapability>)
  • restricted - Requires Store approval (<rescap:Capability>)

Note: runFullTrust is always auto-added (required for Tauri apps).

resourceIndex.enabled generates resources.pri via msixbundle-cli --makepri before packing. Enable this when using qualified assets (for example, scale-specific logos like Square44x44Logo.scale-200.png).

resourceIndex.keepConfig keeps generated priconfig.xml in each AppxContent directory for debugging.

Auto-read from tauri.conf.json / tauri.windows.conf.json:

  • displayName ← productName
  • version ← version (auto-converted to 4-part: 1.0.0 → 1.0.0.0)
  • description ← bundle.shortDescription
  • publisher ← bundle.publisher (fallback when not in bundle.config.json)
  • icons ← bundle.icon
  • resources ← bundle.resources (array entries keep their layout; leading ../ maps to _up_/ and an absolute root to _root_/, matching where Tauri's resolveResource() looks at runtime)
  • externalBin ← bundle.externalBin (sidecars staged beside the exe with the -<target-triple> suffix stripped; a missing declared sidecar fails the build)
  • signing ← bundle.windows.certificateThumbprint

Platform-specific config: Values in tauri.windows.conf.json override tauri.conf.json using JSON Merge Patch (RFC 7396). This lets you define Windows-specific settings like identifier, productName, or bundle.publisher separately.

Build

# Build x64 only (default, uses cargo, release mode)
pnpm tauri:windows:build

# Build multiarch bundle (x64 + arm64)
pnpm tauri:windows:build --arch x64,arm64

# Debug build (release is default)
pnpm tauri:windows:build --debug

# Use different build runner (pnpm, npm, yarn, bun, etc.)
pnpm tauri:windows:build --runner pnpm
pnpm tauri:windows:build --runner npm

# Re-derive Assets/ from bundle.icon (overwrites manual edits in
# src-tauri/gen/windows/Assets/). Variant flags configured at init are
# replayed from bundle.config.json's `assets.variants`.
pnpm tauri:windows:build --regenerate-assets

By default build copies whatever is in src-tauri/gen/windows/Assets/ verbatim, so hand-edited tile icons persist across builds. Pass --regenerate-assets to refresh that directory from the icons folder resolved via bundle.icon (the same logic init uses).

Output

target/msix/
├── MyApp_x64.msix
├── MyApp_arm64.msix      # if --arch x64,arm64
└── MyApp.msixbundle      # combined bundle

CLI Reference

npx @choochmeque/tauri-windows-bundle init [options]
  -p, --path <path>    Path to Tauri project
  --scale              Generate .scale-100/125/150/200/400 PNG variants
  --target-size        Generate .targetsize-16/20/24/30/32/36/40/48/60/64/72/80/96/256 PNG variants for Square44x44Logo
  --unplated           Generate _altform-unplated targetsize variants
  --light-unplated     Generate _altform-lightunplated targetsize variants
  --all-variants       Shortcut for all four variant families above

npx @choochmeque/tauri-windows-bundle build [options]
  --arch <archs>        Architectures (comma-separated: x64,arm64) [default: x64]
  --debug               Build in debug mode (release is default)
  --min-windows <ver>   Minimum Windows version [default: 10.0.17763.0]
  --runner <runner>     Build runner (cargo, pnpm, npm, yarn, bun) [default: cargo]
  --verbose             Show full build output instead of spinner
  --regenerate-assets   Regenerate gen/windows/Assets/ from bundle.icon
                        (overwrites manual edits)

npx @choochmeque/tauri-windows-bundle extension list
  -p, --path <path>    Path to Tauri project

npx @choochmeque/tauri-windows-bundle extension add <type>
  <type>               Extension type (see below)
  -p, --path <path>    Path to Tauri project

npx @choochmeque/tauri-windows-bundle extension remove <type> [name]
  <type>               Extension type (see below)
  [name]               Extension identifier (required for most types)
  -p, --path <path>    Path to Tauri project

Extension types:
  file-association     Associate file types with your app
  protocol             Register URL protocol handlers (myapp://)
  share-target         Receive shared content from other apps
  startup-task         Run app on Windows login
  context-menu         Add right-click menu items in Explorer
  background-task      Run tasks when app is not in foreground
  app-execution-alias  Run app from command line (e.g., myapp)
  app-service          Allow other apps to call into your app
  toast-activation     Handle toast notification clicks
  autoplay             Launch when media/device is inserted
  print-task-settings  Custom print settings UI
  thumbnail-handler    Custom file thumbnails in Explorer
  preview-handler      Custom file previews in Explorer

Windows Extensions

File Associations

npx @choochmeque/tauri-windows-bundle extension add file-association
# Prompts for: name, extensions, description

Alternatively, declare file associations in tauri.conf.json under the standard bundle.fileAssociations key and they are picked up automatically at build time:

{
  "bundle": {
    "fileAssociations": [
      { "ext": ["ics"], "name": "iCalendar", "description": "iCalendar event file" },
    ],
  },
}

bundle.config.json entries are merged on top and win on a name collision, so existing Windows-only overrides keep working.

Protocol Handlers

npx @choochmeque/tauri-windows-bundle extension add protocol
# Prompts for: protocol name, display name

Share Target

# Enable
npx @choochmeque/tauri-windows-bundle extension add share-target

# Disable
npx @choochmeque/tauri-windows-bundle extension remove share-target

Startup Task

Run your app automatically when Windows starts.

# Enable
npx @choochmeque/tauri-windows-bundle extension add startup-task

# Disable
npx @choochmeque/tauri-windows-bundle extension remove startup-task

Context Menu

Add right-click menu items in Windows Explorer.

npx @choochmeque/tauri-windows-bundle extension add context-menu
# Prompts for: menu name, file types, display name

Background Task

Run tasks when app is not in foreground.

npx @choochmeque/tauri-windows-bundle extension add background-task
# Prompts for: task name, type (timer/systemEvent/pushNotification)

List Extensions

npx @choochmeque/tauri-windows-bundle extension list

App Execution Alias

Run your app from command line (e.g., myapp instead of full path).

npx @choochmeque/tauri-windows-bundle extension add app-execution-alias
# Prompts for: alias name

App Service

Allow other apps to call into your app.

npx @choochmeque/tauri-windows-bundle extension add app-service
# Prompts for: service name

Toast Activation

Handle toast notification clicks and actions, including cold-start activations from Action Center after the app has exited.

# Enable
npx @choochmeque/tauri-windows-bundle extension add toast-activation
# Prompts for: CLSID (leave empty to auto-generate from app identifier)

# Disable
npx @choochmeque/tauri-windows-bundle extension remove toast-activation

Emits both the com:Extension Category="windows.comServer" (so Windows knows which exe to launch on activation) and the desktop:Extension Category="windows.toastNotificationActivation" (binding the toast click to the CLSID).

Autoplay

Launch your app when media or devices are inserted.

npx @choochmeque/tauri-windows-bundle extension add autoplay
# Prompts for: verb, action display name, event type (content/device)

Print Task Settings

Add custom print settings UI.

# Enable
npx @choochmeque/tauri-windows-bundle extension add print-task-settings

# Disable
npx @choochmeque/tauri-windows-bundle extension remove print-task-settings

Thumbnail Handler

Provide custom thumbnails for your file types in Explorer.

npx @choochmeque/tauri-windows-bundle extension add thumbnail-handler
# Prompts for: CLSID, file types

Preview Handler

Provide custom file previews in Explorer.

npx @choochmeque/tauri-windows-bundle extension add preview-handler
# Prompts for: CLSID, file types

List Extensions

npx @choochmeque/tauri-windows-bundle extension list

Remove Extension

npx @choochmeque/tauri-windows-bundle extension remove file-association myfiles
npx @choochmeque/tauri-windows-bundle extension remove protocol myapp
npx @choochmeque/tauri-windows-bundle extension remove context-menu open-with-myapp
npx @choochmeque/tauri-windows-bundle extension remove background-task sync-task
npx @choochmeque/tauri-windows-bundle extension remove app-execution-alias myapp
npx @choochmeque/tauri-windows-bundle extension remove app-service com.myapp.service
npx @choochmeque/tauri-windows-bundle extension remove autoplay open

Code Signing

Option 1: PFX Certificate

{
  "signing": {
    "pfx": "path/to/certificate.pfx",
    "pfxPassword": null
  }
}

Set password via environment variable:

export MSIX_PFX_PASSWORD=your-password

Option 2: Windows Certificate Store

Use thumbprint from tauri.conf.json:

{
  "bundle": {
    "windows": {
      "certificateThumbprint": "ABC123..."
    }
  }
}

GitHub Actions

Example workflow for automated MSIX builds.

Note: Run npx @choochmeque/tauri-windows-bundle@latest init locally first to generate the required configuration files, then commit them to your repository.

name: Build Windows MSIX

on:
  push:
    tags:
      - 'v*'
  workflow_dispatch:

jobs:
  build:
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup pnpm
        uses: pnpm/action-setup@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'pnpm'

      - name: Setup Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: x86_64-pc-windows-msvc, aarch64-pc-windows-msvc

      # Caches the cargo registry and build artifacts; cuts warm build times
      # to a fraction of the cold ones.
      - name: Cache Rust
        uses: Swatinem/rust-cache@v2
        with:
          workspaces: src-tauri

      - name: Install dependencies
        run: pnpm install

      # On Windows runners the @choochmeque/msixbundle-cli-win32 sidecar is
      # installed automatically via optionalDependencies. On non-Windows runners
      # (or with --no-optional) install it explicitly:
      #   - run: cargo install msixbundle-cli

      - name: Build MSIX bundle
        run: pnpm tauri:windows:build --arch x64,arm64 --runner pnpm

      - name: Upload artifacts
        uses: actions/upload-artifact@v4
        with:
          name: msix-bundle
          path: src-tauri/target/msix/*.msixbundle

Output will be in src-tauri/target/msix/YourApp.msixbundle.

License

MIT

版本与发布记录

@choochmeque/tauri-windows-bundle 共发布 30 个版本,首次发布于 2026/01/02;过去 12 个月发布了 30 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.2.0latest2026/09/161 个月前
0.1.292026/09/012 个月前
0.1.282026/07/014 个月前
0.1.272026/06/304 个月前
0.1.262026/06/234 个月前
0.1.252026/06/194 个月前

关于 @choochmeque/tauri-windows-bundle 的常见问题

@choochmeque/tauri-windows-bundle 是什么?

MSIX packaging tool for Tauri apps - Windows Store ready bundles

如何安装 @choochmeque/tauri-windows-bundle?

在项目目录运行 npm install @choochmeque/tauri-windows-bundle,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 tauri-windows-bundle,可以用 npx tauri-windows-bundle 直接运行。

@choochmeque/tauri-windows-bundle 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@choochmeque/tauri-windows-bundle 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@choochmeque/tauri-windows-bundle 可以商用吗?

@choochmeque/tauri-windows-bundle 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@choochmeque/tauri-windows-bundle 的下载量有多少?

根据 npm 官方下载统计,@choochmeque/tauri-windows-bundle 在 2026/10/10 – 2026/11/08 这 30 天内被下载 9,941 次,日均约 331 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@choochmeque/tauri-windows-bundle 还在维护吗?

最新版本 0.2.0 发布于 2026/09/16(1 个月前);至今共发布 30 个版本,其中过去 12 个月发布了 30 个;首次发布于 2026/01/02。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。