cmake fails to find Visual Studio generator "Visual Studio 15 2017 Win64" on windows-latest

I am trying to use a build matrix for compiling my cmake-based project, however, when I run CI suite, I get the following error: 

CMake Error at CMakeLists.txt:126 (project):
Generator
Visual Studio 15 2017 Win64
could not find any instance of Visual Studio.

It appears as if cmake fails to find Visual Studio generator “Visual Studio 15 2017 Win64” on windows-latest, specified via 

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

When you try to run your job on windows-latest, it is on a Windows Server 2019 machine.  Windows Server 2019 image doesn’t install visual studio 2017 but visual studio 2019. Please refer to this document: https://help.github.com/en/actions/reference/software-installed-on-github-hosted-runners#visual-studio-2019-enterprise

You could specify vs2019 when build your cmake project. Such as: 

cmake -G “Visual Studio 16 2019” . 

1 Like

Thanks for the quick reply. I’ll go ahead and test that today. 

@yanjingzhu Is there a full list of available windows hosts? For that matter an exhaustive list with a cross reference betwween https://help.github.com/en/actions/reference/software-installed-on-github-hosted-runners#visual-studio-2019-enterprise and matrix options for strategy. 

Visual studio 2017 is installed on windows server 2016. You could use windows-2016 in your matrix as windows os. 

 os: [ubuntu-latest, windows-2016, macos-latest]

If I misunderstood your requirement, please feel free to point me out.