Skip to content

fix: mount VS2022's actual install path into Windows Docker builds - #120

Merged
frostebite merged 1 commit into
mainfrom
fix/windows-docker-vs2022-mount
Aug 24, 2026
Merged

fix: mount VS2022's actual install path into Windows Docker builds#120
frostebite merged 1 commit into
mainfrom
fix/windows-docker-vs2022-mount

Conversation

@frostebite

@frostebite frostebite commented Aug 24, 2026

Copy link
Copy Markdown
Member

Summary

Root-caused a real, previously-misdiagnosed Windows CI failure in game-ci/unity-builder#844. Every StandaloneWindows64/WSAPlayer build fails deep inside IL2CPP:

error: Could not set up a toolchain for Architecture x64. Make sure you have the right build tools installed for il2cpp builds.
IL2CPP C++ code builder is unable to build C++ code. In order to build C++ code for Windows Desktop, you must have one of these installed:
Visual Studio 2015 is detected by looking at "SOFTWARE\Microsoft\VisualStudio\14.0_Config\InstallDir" in the registry...

This looked environmental at first (missing VS workloads on the runner) — but the Docker container starts fine and gets all the way through asset import and script compilation first, which only makes sense if a real VS install exists on the host but isn't actually reaching the container.

Root cause

getWindowsCommand only ever mounts C:/Program Files (x86)/Microsoft Visual Studio into the container. Visual Studio 2022 — the first native 64-bit VS release — installs to C:/Program Files/Microsoft Visual Studio instead. Confirmed against actions/runner-images' own windows-2022 documentation: VS2022 Enterprise lives at C:/Program Files/Microsoft Visual Studio/2022/Enterprise with the MSVC v143 toolset (x64 included). GitHub-hosted windows-2022/windows-latest runners only have VS2022, so the (x86) mount carries no real compiler toolchain into the container — it likely still exists (legacy/shared components get installed there too), which is exactly why Docker itself starts fine and the failure only surfaces deep inside the IL2CPP build step, not at container-start time.

Fix

Mount the VS2022-generation path too, alongside the existing (x86) one (kept for older on-prem/self-hosted VS installs). Guarded by fs.existsSync, same pattern as the registry-keys mount fix, so a host without a VS2022-generation install at this path isn't handed a Docker bind mount for a source that doesn't exist.

Verification

  • tsc --noEmit: shows only the same pre-existing TS5097 import-extension class of errors (one more instance of it, from the new test file's import — not a new error type, confirmed via git stash comparison: 737 baseline vs 738 with this change).
  • bunx oxfmt --check: clean.
  • bun test ./src: 200 pass, 0 fail (docker.test.ts: 16 pass, including 2 new regression tests for this fix).
  • bun run build: succeeds.

Test plan

  • New test: mounts the VS2022 (non-x86) path when it exists on the host, alongside the still-unconditional legacy (x86) mount
  • New test: omits the VS2022 mount (rather than risking a Docker bind-mount error) when that path doesn't exist on the host
  • tsc --noEmit / oxfmt --check clean
  • bun test ./src passes
  • bun run build succeeds

Summary by CodeRabbit

  • New Features

    • Windows Docker builds now include the Visual Studio 2022 installation directory when available.
    • The mount is applied only to the standard Unity workflow, preserving existing behavior for other workflows.
  • Bug Fixes

    • Added regression coverage for environments where the Visual Studio 2022 directory is present or missing.

Root-caused a real, previously-misdiagnosed Windows CI failure in
game-ci/unity-builder#844: every StandaloneWindows64/WSAPlayer build
failed deep inside IL2CPP with "Could not set up a toolchain for
Architecture x64" - looking for VS via a legacy VS2015-era registry
key - despite the Docker container starting successfully and getting
all the way through asset import and script compilation first.

Root cause: getWindowsCommand only ever mounted
"C:/Program Files (x86)/Microsoft Visual Studio" into the container.
Visual Studio 2022 - the first native 64-bit VS release - installs to
"C:/Program Files/Microsoft Visual Studio" instead (confirmed against
actions/runner-images' own windows-2022 documentation: VS2022
Enterprise lives at "C:/Program Files/Microsoft Visual Studio/2022/
Enterprise" with the MSVC v143 toolset). GitHub-hosted windows-2022/
windows-latest runners only have VS2022, so the (x86) mount carries no
real compiler toolchain into the container - it likely still exists
(legacy/shared components), which is why Docker itself started fine
and the failure only surfaced deep inside the IL2CPP build step.

Fix: mount the VS2022-generation path too, alongside the existing
(x86) one (kept for older on-prem/self-hosted VS installs). Guarded
by fs.existsSync, same pattern as the registry-keys mount fix, so a
host without a VS2022-generation install at this path isn't handed a
Docker bind mount for a source that doesn't exist.

Verified: tsc --noEmit shows only the same pre-existing TS5097
import-extension class of errors (one more instance of it, from the
new test file import - not a new error type). bunx oxfmt --check
clean. bun test ./src: 200 pass, 0 fail (docker.test.ts: 16 pass, 2
new regression tests for this fix). bun run build succeeds.
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1766152f-1646-4c03-b28d-0b128daac997

📥 Commits

Reviewing files that changed from the base of the PR and between 49c33e4 and c677503.

📒 Files selected for processing (2)
  • src/model/docker.test.ts
  • src/model/docker.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The Windows Docker command now conditionally mounts the Visual Studio 2022 directory for Unity default flows. Tests cover both path-presence cases and preserve the legacy x86 mount. The diff also normalizes string quotes.

Changes

Windows Visual Studio mount

Layer / File(s) Summary
Windows Docker command behavior
src/model/docker.ts
The command checks C:/Program Files/Microsoft Visual Studio with fs.existsSync and adds its bind mount when applicable. Existing command logic remains unchanged apart from quote normalization.
Windows mount regression coverage
src/model/docker.test.ts
Tests mock filesystem checks and verify VS2022 mount inclusion or omission. Existing Windows Docker coverage and the legacy x86 mount remain covered.

Estimated code review effort: 2 (Simple) | ~15 minutes

Merge Risk: ⚪ Minimal · up to c6775

This localized change adds the Visual Studio 2022 installation path for Windows container builds while preserving the legacy path behavior. No actionable merge-blocking risk remains after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant getWindowsCommand
  participant fs.existsSync
  participant DockerRunCommand
  getWindowsCommand->>fs.existsSync: Check the VS2022 install path
  fs.existsSync-->>getWindowsCommand: Return path presence
  getWindowsCommand->>DockerRunCommand: Add the VS2022 bind mount when present
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: mounting the actual VS2022 installation path in Windows Docker builds.
Description check ✅ Passed The description clearly explains the root cause, fix, verification, and tests, but it omits the template's exact Changes and Checklist sections.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/windows-docker-vs2022-mount

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@frostebite
frostebite merged commit 20059c2 into main Aug 24, 2026
15 checks passed
@frostebite
frostebite deleted the fix/windows-docker-vs2022-mount branch August 24, 2026 17:38
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.

1 participant