Skip to content

Plugin does not detect windowsVsVars file under "C:\Program Files\Microsoft Visual Studio\" #527

@wolpl

Description

@wolpl

What happened?

The plugin does not detect a Visual Studio installation in C:\Program Files\Microsoft Visual Studio, only in C:\Program Files (x86)\Microsoft Visual Studio. Native image generation consequently fails with the error message:

Couldn't find an installation of Windows SDK 7.1 suitable for GraalVM.

This is a problem when trying to use it in GitHub actions. As a workaround, users can set the plugin's windowsVsVarsPath parameter. But because the path probably is different on GitHub actions runners compared to developer PCs, this has to be done in some dirty workaround fashion like this:

// build.gradle.kts
graal {
    javaVersion("11")
    graalVersion("22.3.0")

    // Workaround for GH actions
    val ghActionsVsVarsFile = File("C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat")
    if (ghActionsVsVarsFile.exists()) {
        windowsVsVarsPath(ghActionsVsVarsFile.absolutePath)
    }
}

What did you want to happen?

The plugin should automatically search for Visual Studio installations under C:\Program Files (x86)\Microsoft Visual Studio and C:\Program Files\Microsoft Visual Studio.

Side note

The error message shown above is displayed even though the Java version is set to 11. In my understanding, the Windows SDK 7.1 should only be used with Java 8, I guess the error message just does not differentiate, and always reports missing Windows SDK 7.1 (instead of VS Build Tools)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions