Skip to content

Commit fdac39f

Browse files
Sbussisoclaude
andcommitted
fix(msi): bundle the Visual C++ runtime so the app launches on a clean Windows (v0.3.15)
On a fresh Windows with no VC++ redistributable ever installed, both searchbox.exe and the bundled meilisearch.exe failed to start with STATUS_DLL_NOT_FOUND (0xC0000135) — surfaced by the winget validator's clean VM. wix/build.ps1 now copies the arch-matched VC++ runtime DLLs (vcruntime140, vcruntime140_1, msvcp140) into the payload, and main.wxs installs them next to the exes, so Windows resolves them app-local with no VCRedist. This is the #1 production blocker (and the gating issue for winget validation). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent d5f2674 commit fdac39f

5 files changed

Lines changed: 61 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
## Unreleased
44

5+
## 0.3.15 — 2026-06-02
6+
7+
### Fixed
8+
- **The app now launches on a clean Windows.** `searchbox.exe` and the bundled
9+
`meilisearch.exe` are MSVC-linked and need the Visual C++ runtime; a fresh
10+
Windows that had never installed a VC++ redistributable failed to start either
11+
one (`STATUS_DLL_NOT_FOUND` / 0xC0000135). The MSI now ships the VC++ runtime
12+
DLLs app-local, so no separate redistributable is required. (Surfaced by the
13+
winget validation pipeline, which tests on a clean VM.)
14+
515
## 0.3.14 — 2026-06-02
616

717
### Fixed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "searchbox"
3-
version = "0.3.14"
3+
version = "0.3.15"
44
edition = "2021"
55
description = "SearchBox — local-first document search server"
66
license = "AGPL-3.0-or-later"

wix/build.ps1

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,40 @@ if (Test-Path $MeiliExe) {
6363
Invoke-WebRequest -Uri $MeiliUrl -OutFile $MeiliExe -UseBasicParsing
6464
}
6565

66+
# Bundle the Visual C++ runtime app-local. searchbox.exe + meilisearch.exe are
67+
# MSVC-linked and need vcruntime140.dll etc.; a fresh Windows without any VC++
68+
# redistributable doesn't have them, so both exes fail to start with
69+
# STATUS_DLL_NOT_FOUND (0xC0000135). Shipping the redist DLLs next to the exes
70+
# makes Windows find them with no VCRedist install. (Match the build arch; the
71+
# bundled meilisearch.exe is x64, so it relies on the system's x64 runtime on
72+
# ARM64 — fine on any machine that's ever installed x64 software.)
73+
$crtArch = if ($Target -like 'aarch64*') { 'arm64' } else { 'x64' }
74+
Write-Host "==> Bundling the Visual C++ runtime ($crtArch)"
75+
$crtNames = @('vcruntime140.dll', 'vcruntime140_1.dll', 'msvcp140.dll')
76+
$crtSrc = $null
77+
$vswhere = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe'
78+
if (Test-Path $vswhere) {
79+
$vsRoot = (& $vswhere -latest -products * -property installationPath) | Select-Object -First 1
80+
if ($vsRoot) {
81+
$crtSrc = Get-ChildItem (Join-Path $vsRoot "VC\Redist\MSVC\*\$crtArch\Microsoft.VC*.CRT") -Directory -ErrorAction SilentlyContinue `
82+
| Sort-Object FullName -Descending | Select-Object -First 1
83+
}
84+
}
85+
foreach ($dll in $crtNames) {
86+
$dst = Join-Path $PayloadDir $dll
87+
$done = $false
88+
if ($null -ne $crtSrc) {
89+
$src = Join-Path $crtSrc.FullName $dll
90+
if (Test-Path $src) { Copy-Item $src $dst -Force; $done = $true }
91+
}
92+
if (-not $done -and $crtArch -eq 'x64') {
93+
$sys = Join-Path $env:WINDIR "System32\$dll" # fall back to the runner's own x64 runtime
94+
if (Test-Path $sys) { Copy-Item $sys $dst -Force; $done = $true }
95+
}
96+
if (-not $done) { throw "VC++ runtime '$dll' ($crtArch) not found (VS redist$(if ($crtArch -eq 'x64') { ' / System32' })). Cannot build a self-contained MSI." }
97+
Write-Host " + $dll"
98+
}
99+
66100
Write-Host "==> Generating icon (searchbox.ico)"
67101
# make-icon.ps1 uses $ErrorActionPreference='Stop' so it throws on
68102
# failure — no explicit exit-code check needed (and $LASTEXITCODE

wix/main.wxs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,18 @@
8585
KeyPath="yes"/>
8686
</Component>
8787

88+
<!-- Visual C++ runtime, shipped app-local so the app launches on a
89+
clean Windows with no VCRedist installed (see wix\build.ps1). -->
90+
<Component Id="VCRuntime140" Guid="*" Win64="yes">
91+
<File Id="vcruntime140" Name="vcruntime140.dll" DiskId="1" Source="wix\payload\vcruntime140.dll" KeyPath="yes"/>
92+
</Component>
93+
<Component Id="VCRuntime140_1" Guid="*" Win64="yes">
94+
<File Id="vcruntime140_1" Name="vcruntime140_1.dll" DiskId="1" Source="wix\payload\vcruntime140_1.dll" KeyPath="yes"/>
95+
</Component>
96+
<Component Id="VCRuntimeCpp" Guid="*" Win64="yes">
97+
<File Id="msvcp140" Name="msvcp140.dll" DiskId="1" Source="wix\payload\msvcp140.dll" KeyPath="yes"/>
98+
</Component>
99+
88100
</Directory>
89101
</Directory>
90102
</Directory>
@@ -143,6 +155,9 @@
143155
<ComponentRef Id="Binary"/>
144156
<ComponentRef Id="MeiliSidecar"/>
145157
<ComponentRef Id="License"/>
158+
<ComponentRef Id="VCRuntime140"/>
159+
<ComponentRef Id="VCRuntime140_1"/>
160+
<ComponentRef Id="VCRuntimeCpp"/>
146161
<ComponentRef Id="StartMenuShortcut"/>
147162
<ComponentRef Id="DesktopShortcut"/>
148163
</Feature>

0 commit comments

Comments
 (0)