GitHub Action for setting Visual Studio build environment variables and paths for subsequent steps in the job.
This can be especially useful for building C++ using the MSVC compiler using build tools like CMake which lack the good sense to find VS themselves.
The action can find any compatible VS installation (via required VS components), though it will still always run the vsdevenv command and update the
environment accordingly.
vswhere: Path tovswhere.exe(default system-installed copy).host_arch: Host architecture override (defaults to the processor architecture).arch: Build architecture (defaults to the value of host_arch).winsdk: WinSDK version override.toolset_version: Build toolset version override.components: List of required VS components, semi-colon separated. (includes the latest toolset forarchby default)verbose: Display information about the installation thatvswhereselects.
install_path: Selected VS installation path.
MIT License. See LICENSE for details.
jobs:
build:
- uses: actions/checkout@v6
- uses: step-security/gha-setup-vsdevenv@v6
- run: |
mkdir build
cd build
cmake -DCMAKE_CXX_COMPILER=cl.exe ..
- run: cmake --build build