Skip to content

[bug] tauri wix template issue with registry search for install location #14213

@motiontester83-ship-it

Description

@motiontester83-ship-it

Describe the bug

First of all, this is my first issue post and I am still a bit unsure whether this is even considered a bug or not or just a weird edge case.

We recently migrated from tauri v1 to v2 and noticed that even though we might install the app in C:\Program Files (using the msi install option), after we update with the tauri updater plugin it automatically gets moved the the corresponding local appdata folder instead and then Program Files app folder gets wiped. This never happened when we used tauri v1. The installed location never changed after an update. We noticed by comparing the wix templates tauri provides for the v1 and v2 versions that the v2 version has the following property

        <Property Id="INSTALLDIR">
          <!-- First attempt: Search for "InstallDir" -->
          <RegistrySearch Id="PrevInstallDirWithName" Root="HKCU" Key="Software\\{{manufacturer}}\\{{product_name}}" Name="InstallDir" Type="raw" />

          <!-- Second attempt: If the first fails, search for the default key value (this is how the nsis installer currently stores the path) -->
          <RegistrySearch Id="PrevInstallDirNoName" Root="HKCU" Key="Software\\{{manufacturer}}\\{{product_name}}" Type="raw" />
        </Property>

while the v1 has

        <Property Id="INSTALLDIR">
            <RegistrySearch Id="PrevInstallDirReg" Root="HKCU" Key="Software\\{{manufacturer}}\\{{product_name}}" Name="InstallDir" Type="raw"/>
        </Property>

I also noticed that the registry key in HKCU still had the (default) key set even when we uninstall the app (perhaps some legacy stuff from v1 or when we temporarily tried out nsis that never got cleaned up?). The problem is that in the v2 version our registry have both the (default) key and the (InstallDir) key in the registry and when our tauri updater plugin updates with the .msi updater it automatically chooses the default key instead. We tried swapping the order of the two registry searches in our own app and it now works as expected. Just thought I would open an issue here but not sure if the current template implementation (https://github.com/tauri-apps/tauri/blob/dev/crates/tauri-bundler/src/bundle/windows/msi/main.wxs) is just expected behaviour or not? If so I can close this issue and just cotinue with our "registry swapped template". I would just assume it would always go with the InstallDir registry key over the default one if both exists?

Reproduction

No response

Expected behavior

Install location of the tauri app shouldn't change after using the tauri updater.

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.26100 x86_64 (X64)
    ✔ WebView2: 140.0.3485.81
    ✔ MSVC:
        - Visual Studio Community 2022
        - Visual Studio Professional 2019
    ✔ rustc: 1.89.0 (29483883e 2025-08-04)
    ✔ cargo: 1.89.0 (c24e10642 2025-06-23)
    ✔ rustup: 1.28.2 (e4f3ad6f8 2025-04-28)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 22.14.0
    - pnpm: 8.10.5
    - npm: 11.2.0

[-] Packages
    - tauri 🦀: 2.8.5
    - tauri-build 🦀: 2.4.1
    - wry 🦀: 0.53.3
    - tao 🦀: 0.34.3
    - @tauri-apps/api : 2.8.0
    - @tauri-apps/cli : 2.8.4

[-] Plugins
    - tauri-plugin-http 🦀: 2.5.2
    - @tauri-apps/plugin-http : 2.5.2
    - tauri-plugin-dialog 🦀: 2.4.0
    - @tauri-apps/plugin-dialog : 2.4.0
    - tauri-plugin-updater 🦀: 2.9.0
    - @tauri-apps/plugin-updater : 2.9.0
    - tauri-plugin-os 🦀: 2.3.1
    - @tauri-apps/plugin-os : 2.3.1
    - tauri-plugin-log 🦀: 2.7.0
    - @tauri-apps/plugin-log : not installed!
    - tauri-plugin-deep-link 🦀: 2.4.3
    - @tauri-apps/plugin-deep-link : 2.4.3
    - tauri-plugin-fs 🦀: 2.4.2
    - @tauri-apps/plugin-fs : 2.4.2
    - tauri-plugin-single-instance 🦀: 2.3.4
    - @tauri-apps/plugin-single-instance : not installed!
    - tauri-plugin-shell 🦀: 2.3.1
    - @tauri-apps/plugin-shell : 2.3.1
    - tauri-plugin-notification 🦀: 2.3.1
    - @tauri-apps/plugin-notification : 2.3.1

Stack trace


Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions