# Generating Visual Studio 2019 project without Visual Studio installed

**URL:** https://discourse.cmake.org/t/generating-visual-studio-2019-project-without-visual-studio-installed/5230
**Category:** Usage
**Tags:** os:windows, gen:vs
**Created:** [March 16, 2022, 5:02pm UTC](https://discourse.cmake.org/t/generating-visual-studio-2019-project-without-visual-studio-installed/5230 "2022-03-16T17:02:23Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![c287dd0d995e2c0016e7](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/c/f6c823/32.png) [@c287dd0d995e2c0016e7](https://discourse.cmake.org/u/c287dd0d995e2c0016e7)
#### Post date: [March 16, 2022, 5:02pm UTC](https://discourse.cmake.org/t/generating-visual-studio-2019-project-without-visual-studio-installed/5230/1 "2022-03-16T17:02:23Z")

</div>

Hey,

I got a Windows machine on which I am building some VS 2019 projects using a prepared “portable” folder of MSBuild and related tools, on that system an installation of any Visual Studio is not present.  
I am wondering whether it is possible to generate a VS 2019 project on that machine using CMake? I looked for some solutions and found out about CMAKE\_GENERATOR\_INSTANCE variable ([https://cmake.org/cmake/help/latest/variable/CMAKE\_GENERATOR\_INSTANCE.html#variable:CMAKE\_GENERATOR\_INSTANCE](https://cmake.org/cmake/help/latest/variable/CMAKE_GENERATOR_INSTANCE.html#variable:CMAKE_GENERATOR_INSTANCE)) and it seemed like this part " New in version 3.23: A portable VS instance, which is not known to the Visual Studio Installer, may be specified by providing both `location` and `version=` ." would be helpful to me but when I call cmake like this:

> C:\myCmakeFolder\cmake.exe . -G “Visual Studio 16 2019” -DCMAKE\_GENERATOR\_INSTANCE=“C:\pathTo\Microsoft Visual Studio\2019”[,version=16.10.2.30804]

It throws an error:

> CMake Error at CMakeLists.txt:25 (project):  
> Generator
> 
> ```
> Visual Studio 16 2019
> 
> ```
> 
> given instance specification
> 
> ```
> C:\pathTo\Microsoft Visual Studio\2019[,version=16.10.2.30804]
> 
> ```
> 
> but the version field is not 4 integer components starting in 16.

The version number I’m trying to use I got from calling msbuild. Wanted to see if it works, however the error seems not related to that but rather a syntax issue. What am I missing here?

Thanks in advance for any answer.

---

<div class="post-metadata">

### Author: ![jtxa](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jtxa/32/1535_2.png) [@jtxa](https://discourse.cmake.org/u/jtxa)
#### Post date: [March 17, 2022, 11:46pm UTC](https://discourse.cmake.org/t/generating-visual-studio-2019-project-without-visual-studio-installed/5230/2 "2022-03-17T23:46:51Z")

</div>

The square brackets in the manual usually indicates that something is optional. So do not use them calling CMake:

```
C:\myCmakeFolder\cmake.exe . -G “Visual Studio 16 2019” -DCMAKE_GENERATOR_INSTANCE=“C:\pathTo\Microsoft Visual Studio\2019”,version=16.10.2.30804
```
