GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Improve Visual Studio detection on Windows by gastaldi · Pull Request #228 · graalvm/setup-graalvm

Conversation

@gastaldi

@gastaldi gastaldi commented Jul 7, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

  • Use vswhere.exe for dynamic Visual Studio detection, matching what GraalVM's own native-image does internally via WindowsBuildEnvironmentUtil
  • Expand hardcoded paths to include all four VS editions (Enterprise, Professional, Community, BuildTools) as a fallback
  • Preserve VSINSTALLDIR env var as the highest-priority override
  • Downgrade MSVC setup failure to a warning for JDK 17+, since native-image performs its own VS detection in those versions

Detection order: VSINSTALLDIR → vswhere.exe → hardcoded paths.

Fixes #227.

Test plan

  • Verify on GitHub-hosted runners (windows-latest, windows-2022) — should work as before
  • Verify on self-hosted runner with non-Enterprise VS edition (e.g. Community) — previously failed, should now succeed
  • Verify VSINSTALLDIR env var override still works
  • Verify JDK 17+ with no VS installation produces a warning (not a failure)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gastaldi
Use vswhere.exe to detect Visual Studio installations.
680611c
Use `vswhere.exe` for dynamic Visual Studio detection, matching what
GraalVM's own `native-image` does internally. This correctly finds any
VS edition (Community, Professional, Build Tools, Enterprise) without
relying solely on hardcoded paths.

The detection order is:
1. `VSINSTALLDIR` env var (explicit user override)
2. `vswhere.exe` (dynamic detection)
3. Hardcoded paths (expanded to include all four editions)

Fixes graalvm#227.
@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jul 7, 2026
@gastaldi gastaldi changed the title Use vswhere.exe to detect Visual Studio installations Improve Visual Studio detection on Windows Jul 7, 2026
@gastaldi gastaldi mentioned this pull request Jul 7, 2026
v1.5.6 regression: "Failed to find vcvarsall.bat" on self-hosted runners with non-Enterprise Visual Studio editions #227
Closed
fniephaus
fniephaus approved these changes Jul 8, 2026
View reviewed changes

@fniephaus fniephaus left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM, thank you for the swift PR!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@fniephaus fniephaus assigned gastaldi and fniephaus Jul 8, 2026
@gastaldi @fniephaus
Downgrade MSVC setup failure to warning for JDK 17+
beb258f
Native Image on JDK 17+ performs its own Visual Studio detection, so a
failure in setup-graalvm's MSVC environment setup should not be fatal
for these versions. For older JDKs, the error remains fatal.
@fniephaus
fniephaus force-pushed the fix/vswhere-detection branch 2 times, most recently from 9194354 to beb258f Compare July 8, 2026 15:06
@fniephaus
fniephaus merged commit 6ceeefe into graalvm:main Jul 9, 2026
272 checks passed

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

@fniephaus fniephaus fniephaus approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@gastaldi gastaldi

@fniephaus fniephaus

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

v1.5.6 regression: "Failed to find vcvarsall.bat" on self-hosted runners with non-Enterprise Visual Studio editions

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@gastaldi @fniephaus
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.