# Using VS Generator without a vswhere findable VS install

**URL:** https://discourse.cmake.org/t/using-vs-generator-without-a-vswhere-findable-vs-install/13009
**Category:** Usage
**Created:** [November 21, 2024, 8:02am UTC](https://discourse.cmake.org/t/using-vs-generator-without-a-vswhere-findable-vs-install/13009 "2024-11-21T08:02:45Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Neumann-A](https://discourse.cmake.org/user_avatar/discourse.cmake.org/neumann-a/32/1647_2.png) [@Neumann-A](https://discourse.cmake.org/u/Neumann-A)
#### Post date: [November 21, 2024, 8:02am UTC](https://discourse.cmake.org/t/using-vs-generator-without-a-vswhere-findable-vs-install/13009/1 "2024-11-21T08:02:45Z")

</div>

Following situation:

I have a “portable” (meaning it wasn’t installed) VS and the environment is already set up similar to vcvars env (Meaning it works without problems for Ninja & MSBuild).

I would like to run CMake configure with -G “Visual Studio 2022”. I tried providing CMAKE\_GENERATOR\_INSTANCE etc but CMake complains/errors that the version in that path is not findable with vswhere. Is there a way to force CMake to just generate the project without doing further VS related tests and just trust the user that it will work (maybe setting some extra vars)? I mean in the end it CMake doesn’t need to know all the Details about the VS installation.

---

<div class="post-metadata">

### Author: ![Neumann-A](https://discourse.cmake.org/user_avatar/discourse.cmake.org/neumann-a/32/1647_2.png) [@Neumann-A](https://discourse.cmake.org/u/Neumann-A)
#### Post date: [November 21, 2024, 8:20am UTC](https://discourse.cmake.org/t/using-vs-generator-without-a-vswhere-findable-vs-install/13009/2 "2024-11-21T08:20:15Z")

</div>

Maybe I just need to use 3.31 instead of 3.30.1 since [https://gitlab.kitware.com/cmake/cmake/-/commit/e801d2b2438e0841ec28f466b5b2dfa29b65bc62](https://gitlab.kitware.com/cmake/cmake/-/commit/e801d2b2438e0841ec28f466b5b2dfa29b65bc62) might be the solution?

---

<div class="post-metadata">

### Author: ![Neumann-A](https://discourse.cmake.org/user_avatar/discourse.cmake.org/neumann-a/32/1647_2.png) [@Neumann-A](https://discourse.cmake.org/u/Neumann-A)
#### Post date: [November 21, 2024, 12:58pm UTC](https://discourse.cmake.org/t/using-vs-generator-without-a-vswhere-findable-vs-install/13009/3 "2024-11-21T12:58:13Z")

</div>

Ok the problem is that [https://gitlab.kitware.com/cmake/cmake/-/blob/master/Source/cmVSSetupHelper.cxx#L67](https://gitlab.kitware.com/cmake/cmake/-/blob/master/Source/cmVSSetupHelper.cxx#L67)  
looks for a specific file and I only had `/VC/Auxiliary/Build/Microsoft.VCToolsVersion.v143.default.txt`. A bit annoying that I actually had to build cmake from source and attach a debugger to figure that one out. Would be better if CMake would inform the user about the failure to load that file.
