Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] NSIS bundler: semver version metadata is required to be numeric, but shouldn't be #8038

Open
MHebes opened this issue Oct 17, 2023 · 1 comment · May be fixed by #12136
Open

[bug] NSIS bundler: semver version metadata is required to be numeric, but shouldn't be #8038

MHebes opened this issue Oct 17, 2023 · 1 comment · May be fixed by #12136
Labels
good first issue Good for newcomers status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@MHebes
Copy link

MHebes commented Oct 17, 2023

Describe the bug

When bundling an app with the tauri version e.g. "2.5.0-beta+1a2b3c4d", I get an error that "optional build metadata in app version must be numeric-only".

My understanding is that this limitation only should apply to the Wix bundler (#5286), but I am using NSIS, which uses windows' ProductVersion instead of FileVersion.

Since ProductVersion can accept arbitrary strings, there appears to be no technical reason that this limitation should exist for NSIS bundlers.

Reproduction

  1. Create a tauri project with project > version set to e.g. 0.1.0-beta+123 and tauri > bundle > targets set to "nsis".
  2. tauri build
  3. Observe the correct bundle name, and ProductVersion in the file's properties:
    Finished 1 bundle at:
        .\src-tauri\target\release\bundle\nsis\issue_0.1.0-beta+123_x64-setup.exe

image

  1. Change project > version to 0.1.0-beta+abc
  2. tauri build
  3. Observe the error:
       Error failed to bundle project: optional build metadata in app version must be numeric-only

Expected behavior

Step 6 should function exactly the same as step 3.

Platform and versions

[✔] Environment
    - OS: Windows 10.0.22621 X64
    ✔ WebView2: 118.0.2088.46
    ✔ MSVC: Visual Studio Professional 2022
    ✔ rustc: 1.66.0 (69f9c33d7 2022-12-12)
    ✔ Cargo: 1.66.0 (d65d197ad 2022-11-15)
    ✔ rustup: 1.25.1 (bb60b1e89 2022-07-12)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 16.20.2
    - yarn: 1.22.19
    - npm: 8.19.4

[-] Packages
    - tauri [RUST]: 1.5.2
    - tauri-build [RUST]: 1.5.0
    - wry [RUST]: 0.24.4
    - tao [RUST]: 0.16.4
    - tauri-cli [RUST]: not installed!
    - @tauri-apps/api [NPM]: not installed!
    - @tauri-apps/cli [NPM]: 1.5.2 (outdated, latest: 1.5.4)

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: localhost

Stack trace

No response

Additional context

No response

@MHebes MHebes added status: needs triage This issue needs to triage, applied to new issues type: bug labels Oct 17, 2023
@MHebes
Copy link
Author

MHebes commented Oct 17, 2023

I think you can just:

--- a/tooling/bundler/src/bundle/windows/nsis.rs
+++ b/tooling/bundler/src/bundle/windows/nsis.rs
@@ -124,15 +124,10 @@ fn get_and_extract_nsis(nsis_toolset_path: &Path, _tauri_tools_path: &Path) -> c
 fn add_build_number_if_needed(version_str: &str) -> anyhow::Result<String> {
   let version = semver::Version::parse(version_str).context("invalid app version")?;
   if !version.build.is_empty() {
-    let build = version.build.parse::<u64>();
-    if build.is_ok() {
       return Ok(format!(
         "{}.{}.{}.{}",
         version.major, version.minor, version.patch, version.build
       ));
-    } else {
-      anyhow::bail!("optional build metadata in app version must be numeric-only");
-    }
   }
 
   Ok(format!(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants