diff --git a/.changes/wix-minimum-webview2-version.md b/.changes/wix-minimum-webview2-version.md new file mode 100644 index 000000000000..2b34203f6467 --- /dev/null +++ b/.changes/wix-minimum-webview2-version.md @@ -0,0 +1,12 @@ +--- +"tauri-bundler": minor:feat +"tauri-cli": minor:feat +"@tauri-apps/cli": minor:feat +--- + +Added support for `minimumWebview2Version` option support for the MSI (Wix) installer, the old `bundle > windows > nsis > minimumWebview2Version` is now deprecated in favor of `bundle > windows > minimumWebview2Version` + +Notes: + +- For anyone relying on the `WVRTINSTALLED` `Property` tag in `main.wxs`, it is now renamed to `INSTALLED_WEBVIEW2_VERSION` +- For `tauri-bundler` lib users, the `WindowsSettings` now has a new field `minimum_webview2_version` which can be a breaking change diff --git a/crates/tauri-bundler/src/bundle/settings.rs b/crates/tauri-bundler/src/bundle/settings.rs index 5e2a81b38d4e..4b4804d1715b 100644 --- a/crates/tauri-bundler/src/bundle/settings.rs +++ b/crates/tauri-bundler/src/bundle/settings.rs @@ -532,6 +532,10 @@ pub struct NsisSettings { /// Try to ensure that the WebView2 version is equal to or newer than this version, /// if the user's WebView2 is older than this version, /// the installer will try to trigger a WebView2 update. + #[deprecated( + since = "2.8.0", + note = "Use `WindowsSettings::minimum_webview2_version` instead." + )] pub minimum_webview2_version: Option, } @@ -587,6 +591,10 @@ pub struct WindowsSettings { /// if you are on another platform and want to cross-compile and sign you will /// need to use another tool like `osslsigncode`. pub sign_command: Option, + /// Try to ensure that the WebView2 version is equal to or newer than this version, + /// if the user's WebView2 is older than this version, + /// the installer will try to trigger a WebView2 update. + pub minimum_webview2_version: Option, } impl WindowsSettings { @@ -612,6 +620,7 @@ mod _default { webview_install_mode: Default::default(), allow_downgrades: true, sign_command: None, + minimum_webview2_version: None, } } } diff --git a/crates/tauri-bundler/src/bundle/windows/msi/main.wxs b/crates/tauri-bundler/src/bundle/windows/msi/main.wxs index a08c3b2cc5dc..dec39dadb4bc 100644 --- a/crates/tauri-bundler/src/bundle/windows/msi/main.wxs +++ b/crates/tauri-bundler/src/bundle/windows/msi/main.wxs @@ -283,38 +283,62 @@ {{#if install_webview}} - - - + + + + {{#if download_bootstrapper}} + - + {{/if}} - {{#if webview2_bootstrapper_path}} + - + {{/if}} - {{#if webview2_installer_path}} + - + + + + {{/if}} + + {{#if minimum_webview2_version}} + + + + + + + + + + + + + {{/if}} diff --git a/crates/tauri-bundler/src/bundle/windows/msi/mod.rs b/crates/tauri-bundler/src/bundle/windows/msi/mod.rs index 4c00d8f333c0..ad0533601686 100644 --- a/crates/tauri-bundler/src/bundle/windows/msi/mod.rs +++ b/crates/tauri-bundler/src/bundle/windows/msi/mod.rs @@ -532,6 +532,13 @@ pub fn build_wix_app_installer( } } + if let Some(minimum_webview2_version) = &settings.windows().minimum_webview2_version { + data.insert( + "minimum_webview2_version", + to_json(minimum_webview2_version), + ); + } + if let Some(license) = settings.license_file() { if license.ends_with(".rtf") { data.insert("license", to_json(license)); diff --git a/crates/tauri-bundler/src/bundle/windows/nsis/mod.rs b/crates/tauri-bundler/src/bundle/windows/nsis/mod.rs index 5b7479a84e3c..21d15aa46e35 100644 --- a/crates/tauri-bundler/src/bundle/windows/nsis/mod.rs +++ b/crates/tauri-bundler/src/bundle/windows/nsis/mod.rs @@ -362,7 +362,12 @@ fn build_nsis_app_installer( if let Some(start_menu_folder) = &nsis.start_menu_folder { data.insert("start_menu_folder", to_json(start_menu_folder)); } - if let Some(minimum_webview2_version) = &nsis.minimum_webview2_version { + #[allow(deprecated)] + if let Some(minimum_webview2_version) = nsis + .minimum_webview2_version + .as_ref() + .or(settings.windows().minimum_webview2_version.as_ref()) + { data.insert( "minimum_webview2_version", to_json(minimum_webview2_version), diff --git a/crates/tauri-cli/config.schema.json b/crates/tauri-cli/config.schema.json index 6b76427aabb4..86bfe5d46b33 100644 --- a/crates/tauri-cli/config.schema.json +++ b/crates/tauri-cli/config.schema.json @@ -131,6 +131,7 @@ "allowDowngrades": true, "certificateThumbprint": null, "digestAlgorithm": null, + "minimumWebview2Version": null, "nsis": null, "signCommand": null, "timestampUrl": null, @@ -2225,6 +2226,7 @@ "allowDowngrades": true, "certificateThumbprint": null, "digestAlgorithm": null, + "minimumWebview2Version": null, "nsis": null, "signCommand": null, "timestampUrl": null, @@ -2667,6 +2669,13 @@ "default": true, "type": "boolean" }, + "minimumWebview2Version": { + "description": "Try to ensure that the WebView2 version is equal to or newer than this version,\n if the user's WebView2 is older than this version,\n the installer will try to trigger a WebView2 update.", + "type": [ + "string", + "null" + ] + }, "wix": { "description": "Configuration for the MSI generated with WiX.", "anyOf": [ @@ -3045,7 +3054,8 @@ ] }, "minimumWebview2Version": { - "description": "Try to ensure that the WebView2 version is equal to or newer than this version,\n if the user's WebView2 is older than this version,\n the installer will try to trigger a WebView2 update.", + "description": "Deprecated: use [`WindowsConfig::minimum_webview2_version`] (`bundle > windows > minimumWebview2Version`) instead.\n\n Try to ensure that the WebView2 version is equal to or newer than this version,\n if the user's WebView2 is older than this version,\n the installer will try to trigger a WebView2 update.", + "deprecated": true, "type": [ "string", "null" diff --git a/crates/tauri-cli/src/helpers/config.rs b/crates/tauri-cli/src/helpers/config.rs index ce1f11c5b3b6..f53d8c8693c5 100644 --- a/crates/tauri-cli/src/helpers/config.rs +++ b/crates/tauri-cli/src/helpers/config.rs @@ -117,6 +117,7 @@ pub fn nsis_settings(config: NsisConfig) -> tauri_bundler::NsisSettings { compression: config.compression, start_menu_folder: config.start_menu_folder, installer_hooks: config.installer_hooks, + #[allow(deprecated)] minimum_webview2_version: config.minimum_webview2_version, } } diff --git a/crates/tauri-cli/src/interface/rust.rs b/crates/tauri-cli/src/interface/rust.rs index 9bd46c585d00..e18e8308f444 100644 --- a/crates/tauri-cli/src/interface/rust.rs +++ b/crates/tauri-cli/src/interface/rust.rs @@ -1657,6 +1657,7 @@ fn tauri_config_to_bundle_settings( webview_install_mode: config.windows.webview_install_mode, allow_downgrades: config.windows.allow_downgrades, sign_command: config.windows.sign_command.map(custom_sign_settings), + minimum_webview2_version: config.windows.minimum_webview2_version, }, license: config.license.or_else(|| { settings diff --git a/crates/tauri-schema-generator/schemas/config.schema.json b/crates/tauri-schema-generator/schemas/config.schema.json index 6b76427aabb4..86bfe5d46b33 100644 --- a/crates/tauri-schema-generator/schemas/config.schema.json +++ b/crates/tauri-schema-generator/schemas/config.schema.json @@ -131,6 +131,7 @@ "allowDowngrades": true, "certificateThumbprint": null, "digestAlgorithm": null, + "minimumWebview2Version": null, "nsis": null, "signCommand": null, "timestampUrl": null, @@ -2225,6 +2226,7 @@ "allowDowngrades": true, "certificateThumbprint": null, "digestAlgorithm": null, + "minimumWebview2Version": null, "nsis": null, "signCommand": null, "timestampUrl": null, @@ -2667,6 +2669,13 @@ "default": true, "type": "boolean" }, + "minimumWebview2Version": { + "description": "Try to ensure that the WebView2 version is equal to or newer than this version,\n if the user's WebView2 is older than this version,\n the installer will try to trigger a WebView2 update.", + "type": [ + "string", + "null" + ] + }, "wix": { "description": "Configuration for the MSI generated with WiX.", "anyOf": [ @@ -3045,7 +3054,8 @@ ] }, "minimumWebview2Version": { - "description": "Try to ensure that the WebView2 version is equal to or newer than this version,\n if the user's WebView2 is older than this version,\n the installer will try to trigger a WebView2 update.", + "description": "Deprecated: use [`WindowsConfig::minimum_webview2_version`] (`bundle > windows > minimumWebview2Version`) instead.\n\n Try to ensure that the WebView2 version is equal to or newer than this version,\n if the user's WebView2 is older than this version,\n the installer will try to trigger a WebView2 update.", + "deprecated": true, "type": [ "string", "null" diff --git a/crates/tauri-utils/src/config.rs b/crates/tauri-utils/src/config.rs index 19035d11af58..2b6304069279 100644 --- a/crates/tauri-utils/src/config.rs +++ b/crates/tauri-utils/src/config.rs @@ -926,9 +926,15 @@ pub struct NsisConfig { /// ``` #[serde(alias = "installer-hooks")] pub installer_hooks: Option, + /// Deprecated: use [`WindowsConfig::minimum_webview2_version`] (`bundle > windows > minimumWebview2Version`) instead. + /// /// Try to ensure that the WebView2 version is equal to or newer than this version, /// if the user's WebView2 is older than this version, /// the installer will try to trigger a WebView2 update. + #[deprecated( + since = "2.10.0", + note = "Use `WindowsConfig::minimum_webview2_version` instead." + )] #[serde(alias = "minimum-webview2-version")] pub minimum_webview2_version: Option, } @@ -1043,6 +1049,11 @@ pub struct WindowsConfig { /// The default value of this flag is `true`. #[serde(default = "default_true", alias = "allow-downgrades")] pub allow_downgrades: bool, + /// Try to ensure that the WebView2 version is equal to or newer than this version, + /// if the user's WebView2 is older than this version, + /// the installer will try to trigger a WebView2 update. + #[serde(alias = "minimum-webview2-version")] + pub minimum_webview2_version: Option, /// Configuration for the MSI generated with WiX. pub wix: Option, /// Configuration for the installer generated with NSIS. @@ -1067,6 +1078,7 @@ impl Default for WindowsConfig { tsp: false, webview_install_mode: Default::default(), allow_downgrades: true, + minimum_webview2_version: None, wix: None, nsis: None, sign_command: None,