From 9c3dc802e83df7662cc67e21b1f4bebd40433992 Mon Sep 17 00:00:00 2001 From: Omotola Akeredolu Date: Fri, 3 Jul 2026 09:57:52 -0700 Subject: [PATCH 1/2] feat: support vsInstanceVersion vendor field for Ninja presets (#4698) Allow users to specify a preferred Visual Studio major version in CMakePresets.json vendor settings, enabling VS instance selection for Ninja generator presets without hardcoding installation paths. Example preset configuration: { "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { "vsInstanceVersion": 17 } } } This picks the VS2022 (major version 17) dev environment even when VS2026 (major version 18) is also installed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/presets/preset.ts | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/presets/preset.ts b/src/presets/preset.ts index cb518d3fa..486495d4a 100644 --- a/src/presets/preset.ts +++ b/src/presets/preset.ts @@ -222,7 +222,10 @@ export type OsName = "Windows" | "Linux" | "macOS"; export type VendorVsSettings = { 'microsoft.com/VisualStudioSettings/CMake/1.0': { - hostOS: OsName | OsName[]; + hostOS?: OsName | OsName[]; + intelliSenseMode?: string; + sourceDir?: string; + vsInstanceVersion?: number; [key: string]: any; }; [key: string]: any; @@ -906,6 +909,20 @@ async function getVsDevEnv(opts: VsDevEnvOptions): Promise Date: Wed, 29 Jul 2026 12:16:10 -0700 Subject: [PATCH 2/2] Add CHANGELOG entry for vsInstanceVersion Ninja preset support (#4698) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e55cc9b5-dc8d-413d-a219-8c6418ec1d25 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2792e9df..c8a42204d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ Improvements: - Improve ergonomics of the test explorer UI by removing the project source directory, improving horizontal scrolling experience. [#4562](https://github.com/microsoft/vscode-cmake-tools/issues/4562) [@miss-programgamer](https://github.com/miss-programgamer) - Auto-generate `docs/cmake-settings.md` from `package.json` via CI so documentation never drifts from actual settings. [#4007](https://github.com/microsoft/vscode-cmake-tools/issues/4007) - Pass mandatory compiler arguments from `CMAKE__COMPILER` to cpptools so it can properly determine system include paths and built-in preprocessor macro definitions. Requires CMake 4.3 or newer. [#4627](https://github.com/microsoft/vscode-cmake-tools/pull/4627) [@cwalther](https://github.com/cwalther) +- Add support for a `vsInstanceVersion` vendor field in `CMakePresets.json` so Ninja configure presets can target a specific installed Visual Studio instance (by version) when bootstrapping the developer environment, instead of always using the latest. [#4698](https://github.com/microsoft/vscode-cmake-tools/issues/4698) Bug Fixes: - Fix running a single test from the inline Test CodeLens or the project outline building the default (or all) target instead of the test's own executable; single-test runs now build only that test's target.