-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Describe the bug
On Windows I’m using Tauri v2 with tauri-plugin-updater, shipping installers as MSI (WiX).
Auto-update works fine when the app is installed to the default directory C:\Program Files\Camille.
However, when the app is installed to a custom directory (e.g. D:\Apps\Camille), updates enter a loop:
The app detects an update
download_and_install() appears to succeed (no error shown)
I call app.restart()
After restart, the app is still the old version
On next launch it detects the update again → repeats forever
This looks like the MSI upgrade may not be installing to the original directory, or the upgrade is not recognized as an upgrade (thus not replacing the existing installation).
Steps to reproduce
Install version OLD_VERSION via MSI to a non-default install path (e.g. D:\Apps\Camille).
Release version NEW_VERSION so the updater can detect it.
Launch OLD_VERSION, trigger update check → update found → run download_and_install().
After installation completes, call app.restart().
App restarts but remains on OLD_VERSION.
Relaunch again → update prompt appears again → loop.
Control: If OLD_VERSION is installed to C:\Program Files\Camille, the update works correctly and restarts into NEW_VERSION.
Update code snippet
pub async fn check_update(app: &AppHandle)-> tauri_plugin_updater::Result<()> {
let _ = app.emit_to("loading","update","检查更新");
let instant = Instant::now();
if let Some(update) = app.updater()?.check().await? {
info!("有新版本,耗时:{}ms",instant.elapsed().as_millis());
let new_version = format!("有新版本:{}",update.version);
let _ = app.emit_to("loading","update",new_version);
let mut downloaded = 0;
update
.download_and_install(
|chunk_length, content_length| {
downloaded += chunk_length;
// 计算下载百分比
let percentage = if let Some(total) = content_length {
Some((downloaded as f64 / total as f64) * 100.0)
} else {
None
};
// 打印下载进度
if let Some(percent) = percentage {
let percent = format!("发现新版本正在更新:{}下载进度: {:.2}%", update.version,percent);
/*// 向前端发送进度更新
let progress_data = serde_json::json!({
"downloaded": downloaded,
"total": content_length,
"percentage": percent.clone()
});*/
let _ = app.emit_to("loading", "update", percent.clone());
println!("{}",percent);
}
},
|| {
let _ = app.emit_to("loading","update", "下载完成");
},
)
.await?;
info!("更新安装完成,准备重启");
let _ = app.emit_to("loading","update", "更新安装完成,准备重启");
tokio::time::sleep(Duration::from_secs(2)).await;
app.restart();
}else {
info!("当前已是最新版本");
let _ = app.emit_to("loading","update", "当前已是最新版本");
info!("当前已是最新版本,耗时:{}ms",instant.elapsed().as_millis());
}
Ok(())
}
tauri.config.json
"plugins": {
"updater": {
"pubkey": "xxxxx",
"endpoints": [
"http://localhost:8088/api/checkUpdate/{{target}}/{{arch}}/{{current_version}}"
],
"windows": {
"installMode": "passive"
},
"dangerousInsecureTransportProtocol":true
}
}
Reproduction
No response
Expected behavior
Updates should successfully upgrade the app regardless of whether it’s installed to the default directory or a custom directory, without repeating update prompts.
Full tauri info output
[✔] Environment
- OS: Windows 10.0.26200 x86_64 (X64)
✔ WebView2: 144.0.3719.82
✔ MSVC: Visual Studio Community 2022
✔ rustc: 1.88.0 (6b00bc388 2025-06-23)
✔ cargo: 1.88.0 (873a06493 2025-05-10)
✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
✔ Rust toolchain: stable-x86_64-pc-windows-msvc (environment override by RUSTUP_TOOLCHAIN)
- node: 22.12.0
- pnpm: 8.15.6
- yarn: 1.22.22
- npm: 11.7.0
[-] Packages
- tauri-cli 🦀: 2.8.4 (outdated, latest: 2.9.6)
- @tauri-apps/api : not installed!
- @tauri-apps/cli : 2.8.4 (outdated, latest: 2.9.6)
[-] Plugins
[-] App
Stack trace
Additional context
No response