Loading...
Loading...
Compare original and translation side by side
| Format | Extension | Build Platform | Notes |
|---|---|---|---|
| WiX MSI | | Windows only | Traditional Windows installer |
| NSIS | | Cross-platform | Can build on Linux/macOS |
| 格式 | 扩展名 | 构建平台 | 说明 |
|---|---|---|---|
| WiX MSI | | 仅Windows | 传统Windows安装程序 |
| NSIS | | 跨平台 | 可在Linux/macOS上构建 |
npm run tauri buildnpm run tauri buildundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefined
**Prerequisites (macOS):**
```bash
**前置依赖(macOS):**
```bash
**Build command:**
```bash
npm run tauri build -- --runner cargo-xwin --target x86_64-pc-windows-msvc
**构建命令:**
```bash
npm run tauri build -- --runner cargo-xwin --target x86_64-pc-windows-msvc| Mode | Internet Required | Size Impact | Best For |
|---|---|---|---|
| Yes | 0 MB | Default, smallest installer |
| Yes | ~1.8 MB | Better Windows 7 support |
| No | ~127 MB | Offline/air-gapped environments |
| No | ~180 MB | Controlled enterprise deployment |
| No | 0 MB | Not recommended |
| 模式 | 需要联网 | 体积影响 | 适用场景 |
|---|---|---|---|
| 是 | 0 MB | 默认选项,安装程序体积最小 |
| 是 | ~1.8 MB | 更好支持Windows 7系统 |
| 否 | ~127 MB | 离线/隔离网络环境 |
| 否 | ~180 MB | 受控企业部署场景 |
| 否 | 0 MB | 不推荐使用 |
{
"bundle": {
"windows": {
"webviewInstallMode": {
"type": "embedBootstrapper" // or: downloadBootstrapper, offlineInstaller, fixedVersion
}
}
}
}fixedVersion"path": "./WebView2Runtime"{
"bundle": {
"windows": {
"webviewInstallMode": {
"type": "embedBootstrapper" // 可选值:downloadBootstrapper, offlineInstaller, fixedVersion
}
}
}
}fixedVersion"path": "./WebView2Runtime"{
"bundle": {
"windows": {
"wix": {
"template": "./windows/custom-template.wxs"
}
}
}
}{
"bundle": {
"windows": {
"wix": {
"template": "./windows/custom-template.wxs"
}
}
}
}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>{
"bundle": {
"windows": {
"wix": {
"fragmentPaths": ["./windows/fragments/registry.wxs"],
"componentRefs": ["MyFragmentRegistryEntries"]
}
}
}
}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>{
"bundle": {
"windows": {
"wix": {
"fragmentPaths": ["./windows/fragments/registry.wxs"],
"componentRefs": ["MyFragmentRegistryEntries"]
}
}
}
}{
"bundle": {
"windows": {
"wix": {
"language": ["en-US", "fr-FR", "de-DE"], // Single: "fr-FR"
"localePath": "./windows/locales" // Optional: custom locale files
}
}
}
}{
"bundle": {
"windows": {
"wix": {
"language": ["en-US", "fr-FR", "de-DE"], // 单一语言示例:"fr-FR"
"localePath": "./windows/locales" // 可选:自定义语言文件路径
}
}
}
}| Mode | Admin Required | Install Location | Use Case |
|---|---|---|---|
| No | | Default, no elevation |
| Yes | | System-wide install |
| Yes | User choice | Flexible deployment |
{
"bundle": {
"windows": {
"nsis": {
"installMode": "perMachine"
}
}
}
}| 模式 | 需要管理员权限 | 安装路径 | 适用场景 |
|---|---|---|---|
| 否 | | 默认选项,无需权限提升 |
| 是 | | 系统级全局安装 |
| 是 | 用户可选 | 灵活部署场景 |
{
"bundle": {
"windows": {
"nsis": {
"installMode": "perMachine"
}
}
}
}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{
"bundle": {
"windows": {
"nsis": {
"installerHooks": "./windows/hooks.nsh"
}
}
}
}src-tauri/windows/hooks.nsh!macro NSIS_HOOK_PREINSTALL
; 文件安装前执行
DetailPrint "Preparing installation..."
!macroend
!macro NSIS_HOOK_POSTINSTALL
; 安装完成后执行
DetailPrint "Configuring application..."
; 示例:安装VC++运行库
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
; 卸载前执行
DetailPrint "Cleaning up..."
!macroend
!macro NSIS_HOOK_POSTUNINSTALL
; 卸载完成后执行
DetailPrint "Removal complete"
!macroend{
"bundle": {
"windows": {
"nsis": {
"installerHooks": "./windows/hooks.nsh"
}
}
}
}{
"bundle": {
"windows": {
"nsis": {
"languages": ["English", "French", "German", "Spanish"],
"displayLanguageSelector": true
}
}
}
}{
"bundle": {
"windows": {
"nsis": {
"languages": ["English", "French", "German", "Spanish"],
"displayLanguageSelector": true
}
}
}
}{
"bundle": {
"windows": {
"nsis": {
"minimumWebview2Version": "110.0.1531.0"
}
}
}
}{
"bundle": {
"windows": {
"nsis": {
"minimumWebview2Version": "110.0.1531.0"
}
}
}
}{
"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"
}
}
}
}{
"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"
}
}
}
}{
"bundle": {
"windows": {
"webviewInstallMode": {
"type": "embedBootstrapper"
}
}
}
}Cargo.toml[dependencies]
tauri = { version = "2", features = ["windows7-compat"] }{
"bundle": {
"windows": {
"webviewInstallMode": {
"type": "embedBootstrapper"
}
}
}
}Cargo.toml[dependencies]
tauri = { version = "2", features = ["windows7-compat"] }$env:TAURI_BUNDLER_WIX_FIPS_COMPLIANT = "true"
npm run tauri buildset TAURI_BUNDLER_WIX_FIPS_COMPLIANT=true
npm run tauri build$env:TAURI_BUNDLER_WIX_FIPS_COMPLIANT = "true"
npm run tauri buildset TAURI_BUNDLER_WIX_FIPS_COMPLIANT=true
npm run tauri buildtauri.microsoftstore.conf.json{
"bundle": {
"windows": {
"webviewInstallMode": {
"type": "offlineInstaller"
}
}
},
"identifier": "com.yourcompany.yourapp",
"publisher": "Your Company Name"
}tauri.microsoftstore.conf.json{
"bundle": {
"windows": {
"webviewInstallMode": {
"type": "offlineInstaller"
}
}
},
"identifier": "com.yourcompany.yourapp",
"publisher": "Your Company Name"
}npm run tauri icon /path/to/app-icon.pngnpm run tauri icon /path/to/app-icon.pngnpm run tauri build -- --config tauri.microsoftstore.conf.jsonnpm run tauri build -- --config tauri.microsoftstore.conf.jsoncom.myapp.myapp{
"identifier": "com.myapp.myapp",
"publisher": "MyApp Software Inc"
}com.myapp.myapp{
"identifier": "com.myapp.myapp",
"publisher": "MyApp Software Inc"
}{
"bundle": {
"windows": {
"certificateThumbprint": "YOUR_CERTIFICATE_THUMBPRINT",
"timestampUrl": "http://timestamp.digicert.com"
}
}
}{
"bundle": {
"windows": {
"certificateThumbprint": "YOUR_CERTIFICATE_THUMBPRINT",
"timestampUrl": "http://timestamp.digicert.com"
}
}
}undefinedundefinedundefinedundefinedhttp://timestamp.digicert.comhttp://timestamp.sectigo.comhttp://timestamp.globalsign.com/tsa/r6advanced1http://timestamp.digicert.comhttp://timestamp.sectigo.comhttp://timestamp.globalsign.com/tsa/r6advanced1