Closed acktsap closed 1 year ago
Hi @acktsap, thanks for bringing this to our attention. How would you suggest should we add support for your use case? Is there a canonical way to specify the installation directory for Visual Studio? Or would it be enough to check for Enterprise
and Community
sub-directories?
Mh, maybe we should use vswhere.exe
?
Thanks for reply!
How would you suggest should we add support for your use case?
At first i thought it's enough to search Community, Professional, Build Tools directory.
But it's nice to search special environment variable like GRAALVM_ACTION_VS_PATH
(eg. GRAALVM_ACTION_VS_PATH='C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools')\
Maybe logic would be
GRAALVM_ACTION_VS_PATH
, then search KNOWN_VISUAL_STUDIO_INSTALLATIONS
. KNOWN_VISUAL_STUDIO_INSTALLATIONS
includes all Visual Studio editions like Enterprise, Community, BuildTools, Professional, ...)GRAALVM_ACTION_VS_PATH
is set, search with it.Mh, maybe we should use vswhere.exe?
It looks nice but i think it's a little bit complicated then just setting environment variable.
I have only community and just added a symbolic link to the community folder, so in my case I made c:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\
link to c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\
.
I've adjusted the search so that it checks the VSINSTALLDIR
environment variable, which is apparently usually used to reference the Visual Studio installation directory. This should be enough for your use case.
If anyone thinks we should expand the search so that it also checks \Community
and other directories by default, please let us know!
Hi i registered VSINSTALLDIR
as BuildTools path (C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools
) and it finds vcvarsall.bat
correctly. But it fails to run nativeCompile
task (gradle task) printing it cannot find cl.exe
in a path.
But it works correctly when coping C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools
to C:\Program Files\Microsoft Visual Studio\2022\Enterprise
.
So i looked around the parameter and found graalvm pathes are different.
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools
Path:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildToolsMSBuild\Current\bin\Roslyn
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\amd64
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools
to C:\Program Files\Microsoft Visual Studio\2022\Enterprise
Path:
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\bin\HostX64\x64
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\VC\VCPackages
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\bin\Roslyn
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\\MSBuild\Current\Bin\amd64
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\VC\Linux\bin\ConnectionManagerExe
So i got back to the workaround :(
Currently only paths for visual studio enterprise edition is registered in KNOWN_VISUAL_STUDIO_INSTALLATIONS.
https://github.com/graalvm/setup-graalvm/blob/cb74ef5a33ed1dff1f7661c5a2ed0fc097dba5d5/src/msvc.ts#L6-L10
I'm using self-hosted runner for windows. But doesn't have Visual Studio Enterprise license. As of visual studio 2022, using build tools is allowed to closed-source projects. So i've installed but failed to run graalvm action since path is fixed.
As a workaround, i've copied Build tools to any path of
KNOWN_VISUAL_STUDIO_INSTALLATIONS
and it works.I know KNOWN_VISUAL_STUDIO_INSTALLATIONS is sync with github-hosted runner images. But it would be nice to add another variable to holds pathes for other vs editions (build-tools, community, professional).