{"record":{"id":"68f1c97aaf2360ae","repo":"tauri-apps/tauri","slug":"failed-to-extract-visual-c-runtime-dll-filename","errorCode":null,"errorMessage":"failed to extract Visual C++ runtime DLL filename","messagePattern":"failed to extract Visual C\\+\\+ runtime DLL filename","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-bundler/src/bundle/windows/nsis/mod.rs","lineNumber":817,"sourceCode":"      }\n      added_resources.push(loader_path.clone());\n      resources.insert(\n        loader_path,\n        (PathBuf::new(), PathBuf::from(\"WebView2Loader.dll\")),\n      );\n    }\n  }\n\n  if settings.windows().bundle_vc_runtime {\n    for dll in vc_runtime_dlls(settings.binary_arch())? {\n      let dll = dunce::simplified(&dll).to_path_buf();\n      if added_resources.contains(&dll) {\n        continue;\n      }\n      let target = PathBuf::from(\n        dll\n          .file_name()\n          .expect(\"failed to extract Visual C++ runtime DLL filename\"),\n      );\n      added_resources.push(dll.clone());\n      resources.insert(dll, (PathBuf::new(), target));\n    }\n  }\n\n  for resource in settings.resource_files().iter() {\n    let resource = resource?;\n\n    let src = cwd.join(resource.path());\n    let resource_path = dunce::simplified(&src).to_path_buf();\n\n    // In some glob resource paths like `assets/**/*` a file might appear twice\n    // because the `tauri_utils::resources::ResourcePaths` iterator also reads a directory\n    // when it finds one. So we must check it before processing the file.\n    if added_resources.contains(&resource_path) {\n      continue;\n    }","sourceCodeStart":799,"sourceCodeEnd":835,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-bundler/src/bundle/windows/nsis/mod.rs#L799-L835","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Verify Visual Studio Build Tools with the VC++ redistributable feature are installed and repair them via the Visual Studio Installer.","Check that the resolved redist directory actually contains the expected DLL files (e.g. vcruntime140.dll).","Re-run the build in a clean shell so PATH-based tool discovery is not polluted.","Update tauri-bundler / tauri-cli in case of a redist-lookup bug fixed upstream."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-build check on Windows: confirm VC runtime redist DLLs exist\nuse std::path::Path;\nlet redist = Path::new(r\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Redist\\MSVC\");\nassert!(redist.exists(), \"VC++ redistributable not installed; install VS Build Tools\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install Visual Studio Build Tools with the VC++ redistributable feature on CI and dev machines.","Run builds in a clean, well-known environment image.","Keep tauri-bundler updated for redist-lookup fixes."],"tags":["windows","nsis","vcruntime","path","bundler"],"backgroundTag":"internal-invariant-violation","analyzedSha":"460ec35447493200d64290dd7f015d5a91d0fd58","analyzedAt":"2026-09-18T23:55:51.277Z","contentChangedAt":"2026-09-18T23:55:51.277Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}