Skip to content

fix(bundle-windows): resolve Visual Studio and Inno Setup instead of hardcoded paths - #257

Open
CSEliot wants to merge 1 commit into
66HEX:masterfrom
CSEliot:fix/bundle-windows-tool-paths
Open

CSEliot wants to merge 1 commit into
66HEX:masterfrom
CSEliot:fix/bundle-windows-tool-paths

Conversation

@CSEliot

@CSEliot CSEliot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #255.

script/bundle-windows.ps1 hardcoded two external tool locations: the Visual Studio 2022 Community dev shell and C:\Program Files (x86)\Inno Setup 6\ISCC.exe. On a machine with the documented VS 2022 Build Tools install (under Program Files (x86)), VS 18, or a Professional/Enterprise layout, the dev shell was skipped silently. A per-user Inno install, a PATH shim, or a different drive produced a late Inno Setup is required error after the full build.

Changes

  • Visual Studio: Find-VsDevShell uses vswhere (-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64), prefers the documented 17.x generation, then considers every other installation, derives Common7\Tools\Launch-VsDevShell.ps1, warns with remediation when nothing is found, and honours -VsInstallPath (authoritative) and -SkipDevShell.
  • Inno Setup: Find-ISCC resolves -ISCCPath, ISCC_PATH, PATH, the HKLM/HKCU Inno Setup 6 uninstall keys, then the default install directories, before any Cargo work. Explicit paths must be an existing .exe, not a directory or arbitrary file. -PrepareOnly skips the check. Failures list what was checked and the install command.
  • Argument binding: PositionalBinding is disabled, with -Architecture kept as position 0, so a stray path argument can no longer bind to an override parameter.
  • Docs: the CONTRIBUTING Windows section now documents the bundle output, -Install behavior (Start-Process has no -Wait), the per-user install layout, the unchecked desktop shortcut, the silent install command, the resolver behavior, and the overrides.
  • No changes to inno/frame.iss; no workflow changes.

Testing

  • -Help lists the new options and exits 0. bundle-windows.ps1 x86_64 -Help still binds -Architecture; a second positional argument is rejected.
  • -PackageOnly resolves ISCC through the Chocolatey shim and rebuilds the installer: Successful compile (118.906 sec).
  • -PackageOnly -ISCCPath "C:\Program Files (x86)\Inno Setup 6", -ISCCPath C:\Windows\win.ini, a bad ISCC_PATH, and a path with illegal characters (C:\bad|path\ISCC.exe) all fail fast with ISCC.exe not found at ....
  • -PrepareOnly -VsInstallPath C:\nope fails with the rebuilt Launch-VsDevShell.ps1 not found message.
  • -PrepareOnly selects C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\Launch-VsDevShell.ps1, prepares the inputs, and compiles nothing on the follow-up run.
  • A full direct run of script/bundle-windows.ps1 exits 0, resolves both tools, and writes target\Frame-x86_64.exe (Successful compile (118.266 sec)). The release build was already warm (no Compiling lines), so this run exercises resolution and packaging rather than a cold build.
  • git diff --check passes.

Ordering

This should land after #256. The hardcoded path skipped the dev shell on BuildTools layouts; this change makes the import active, which sets VCINSTALLDIR and VSCMD_ARG_TGT_ARCH before the script's nested cargo xtask setup-ffmpeg. #256 removes that nested call, which is what keeps the running xtask.exe from being relinked; the env scrub alone does not remove those variables. The two branches also edit the same Param/Help-Info blocks, so expect two trivial conflicts on rebase; the combined Usage: line must list both -SkipSetupFfmpeg and the new options. The label-gated run_bundling job is the only workflow that runs this script end to end, and it has not run on this PR.

@CSEliot
CSEliot requested a review from 66HEX as a code owner November 14, 2026 15:08
@CSEliot
CSEliot force-pushed the fix/bundle-windows-tool-paths branch from 21ba065 to 1abfff5 Compare November 14, 2026 15:23
The Windows bundle hardcoded the Visual Studio 2022 Community dev shell
and the Inno Setup 6 compiler, so a documented VS 2022 Build Tools
install (or VS 18, a Professional/Enterprise layout, a per-user Inno
install, or a Chocolatey shim) was ignored or produced a late,
unexplained failure.

Locate the dev shell with vswhere, preferring the documented VS 2022
generation before any newer install, and warn instead of skipping
silently. Locate ISCC through -ISCCPath, ISCC_PATH, PATH, the Inno
Setup uninstall registry entries, and the default install directories,
and resolve it before any Cargo work so a missing compiler fails fast.
Add -VsInstallPath, -ISCCPath and -SkipDevShell overrides, validate
explicit ISCC paths as existing .exe files, keep positional binding
limited to -Architecture, and document the bundle output, -Install
behavior, per-user install layout, silent install command, and tool-path
overrides in CONTRIBUTING.

Fixes 66HEX#255.
@CSEliot
CSEliot force-pushed the fix/bundle-windows-tool-paths branch from 1abfff5 to ae33fb8 Compare November 14, 2026 17:38

@66HEX 66HEX left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! The vswhere and ISCC.exe resolution logic, PositionalBinding = $false, and docs updates look very solid overall.

Before we merge (and after #256 lands, since both touch script/bundle-windows.ps1), could you make two small hardening tweaks in Find-VsDevShell?

  1. Use Test-Path -LiteralPath $candidate -PathType Leaf (matching Test-ISCCPath) so paths containing wildcard characters or matching a directory name are handled safely.
  2. Guard ${env:ProgramFiles(x86)} before calling Join-Path in case the env var is unset.

Once #256 is merged and this is rebased with those tweaks, we'll run CI and get it in.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: bundle-windows.ps1 hardcodes external tool paths and silently skips valid Visual Studio installs

2 participants