diff --git a/.changes/change.md b/.changes/change.md new file mode 100644 index 000000000000..80e314deee5f --- /dev/null +++ b/.changes/change.md @@ -0,0 +1,5 @@ +--- +'tauri-bundler': 'patch:bug' +--- + +The NSIS bundler will now replace non-numeric build metadata with `0` instead of returning an error. diff --git a/crates/tauri-bundler/src/bundle/windows/nsis/mod.rs b/crates/tauri-bundler/src/bundle/windows/nsis/mod.rs index 16d9df682954..a61625af3ddb 100644 --- a/crates/tauri-bundler/src/bundle/windows/nsis/mod.rs +++ b/crates/tauri-bundler/src/bundle/windows/nsis/mod.rs @@ -131,7 +131,7 @@ fn get_and_extract_nsis(nsis_toolset_path: &Path, _tauri_tools_path: &Path) -> c Ok(()) } -fn add_build_number_if_needed(version_str: &str) -> anyhow::Result { +fn try_add_numeric_build_number(version_str: &str) -> anyhow::Result { let version = semver::Version::parse(version_str).context("invalid app version")?; if !version.build.is_empty() { let build = version.build.parse::(); @@ -141,7 +141,10 @@ fn add_build_number_if_needed(version_str: &str) -> anyhow::Result { version.major, version.minor, version.patch, version.build )); } else { - anyhow::bail!("optional build metadata in app version must be numeric-only"); + log::warn!( + "Unable to parse version build metadata. Numeric value expected, received: `{}`. This will be replaced with `0` in `VIProductVersion` because Windows requires this field to be numeric.", + version.build + ); } } @@ -150,6 +153,7 @@ fn add_build_number_if_needed(version_str: &str) -> anyhow::Result { version.major, version.minor, version.patch, )) } + fn build_nsis_app_installer( settings: &Settings, _nsis_toolset_path: &Path, @@ -214,7 +218,7 @@ fn build_nsis_app_installer( data.insert("version", to_json(version)); data.insert( "version_with_build", - to_json(add_build_number_if_needed(version)?), + to_json(try_add_numeric_build_number(version)?), ); data.insert(