tauri-apps/tauri · error

failed to extract Visual C++ runtime DLL filename

Error message

failed to extract Visual C++ runtime DLL filename

What it means

In generate_resource_data, tauri-bundler copies the Visual C++ runtime DLLs into the NSIS installer resources. For each DLL path it calls Path::file_name() and .expect()s a value; if the path somehow has no final component (empty/root path), the panic 'failed to extract Visual C++ runtime DLL filename' fires. This effectively indicates the resolved VC runtime DLL path is malformed.

Solutions

  1. Verify Visual Studio Build Tools with the VC++ redistributable feature are installed and repair them via the Visual Studio Installer.
  2. Check that the resolved redist directory actually contains the expected DLL files (e.g. vcruntime140.dll).
  3. Re-run the build in a clean shell so PATH-based tool discovery is not polluted.
  4. Update tauri-bundler / tauri-cli in case of a redist-lookup bug fixed upstream.
Defensive patterns

Strategy: validation

Validate before calling

// Pre-build check on Windows: confirm VC runtime redist DLLs exist
use std::path::Path;
let redist = Path::new(r"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Redist\MSVC");
assert!(redist.exists(), "VC++ redistributable not installed; install VS Build Tools");

Prevention

When it happens

Trigger: build_nsis_app_installer -> generate_resource_data when a VC redistributable DLL path resolves to a path with no file name component (e.g. an empty or root path produced while locating the VC runtime redist).

Common situations: Broken or missing Visual Studio Build Tools installation causing the VC redist lookup to return a degenerate path; unusual target triple resolution; corrupted environment/registry state used to locate the redistributable.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of tauri-apps/tauri@460ec35447 (2026-09-18). Data as JSON: /api/errors/68f1c97aaf2360ae. Report an issue: GitHub.

Appendix: source

Thrown at crates/tauri-bundler/src/bundle/windows/nsis/mod.rs:817

      }
      added_resources.push(loader_path.clone());
      resources.insert(
        loader_path,
        (PathBuf::new(), PathBuf::from("WebView2Loader.dll")),
      );
    }
  }

  if settings.windows().bundle_vc_runtime {
    for dll in vc_runtime_dlls(settings.binary_arch())? {
      let dll = dunce::simplified(&dll).to_path_buf();
      if added_resources.contains(&dll) {
        continue;
      }
      let target = PathBuf::from(
        dll
          .file_name()
          .expect("failed to extract Visual C++ runtime DLL filename"),
      );
      added_resources.push(dll.clone());
      resources.insert(dll, (PathBuf::new(), target));
    }
  }

  for resource in settings.resource_files().iter() {
    let resource = resource?;

    let src = cwd.join(resource.path());
    let resource_path = dunce::simplified(&src).to_path_buf();

    // In some glob resource paths like `assets/**/*` a file might appear twice
    // because the `tauri_utils::resources::ResourcePaths` iterator also reads a directory
    // when it finds one. So we must check it before processing the file.
    if added_resources.contains(&resource_path) {
      continue;
    }

View on GitHub (pinned to 460ec35447)