Skip to content

[Microsoft.DotNet.CMake.Sdk] Resolve the Visual Studio 18 2026 CMake generator - #17520

Merged
akoeplinger merged 4 commits into
mainfrom
copilot/add-visual-studio-2026-generator-resolution
Sep 9, 2026
Merged

akoeplinger merged 4 commits into
mainfrom
copilot/add-visual-studio-2026-generator-resolution

Conversation

Copilot AI commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

ResolveVSGenerator defaulted VSGeneratorVersionRange to [15,18.0) and only mapped VS 16/17, so <CMakeGenerator>Visual Studio</CMakeGenerator> could never select Visual Studio 18 2026. Consumers such as dotnet/runtime had to duplicate the resolver and set the multi-configuration/architecture properties themselves.

Changes

  • Version range: default VSGeneratorVersionRange is now [15,19.0) so vswhere reports a VS 18 install.
  • Generator mapping: 18.* → Visual Studio 18 2026, alongside the existing 16/17 mappings. Architecture handling (x86 → Win32, -A $(Platform), multi-config output layout) is unchanged and applies as-is.
  • CMake capability check: cmake --help is scanned for the resolved generator, and a targeted error is raised when it's missing (Visual Studio 18 2026 requires CMake 4.2+) instead of a bare CMake configure failure. The check is skipped when cmake can't be executed, so the existing failure mode surfaces instead.
  • Tests: new src/Microsoft.DotNet.CMake.Sdk.Tests covering the 16/17/18 mappings, the default version range, the x86 → Win32 mapping, the multi-config/architecture properties, and the new diagnostic. Follows the targets-inspection pattern in TestArchitecturesTests; picked up automatically by tests/UnitTests.proj.
  • Docs: VSGeneratorVersionRange is now documented in the SDK README, since the new error message points at it as the escape hatch.

Consumers can now use the standard path:

<PropertyGroup>
  <CMakeGenerator>Visual Studio</CMakeGenerator>
  <Platform>x86</Platform>
</PropertyGroup>
<!-- resolves to: cmake -G "Visual Studio 18 2026" -A Win32 ... -->

To double check:

Note: the generator mapping and diagnostic are covered by unit tests, but an end-to-end configure against a real VS 18 + CMake 4.2 install has not been exercised here — worth a manual pass on a machine with VS 18 installed.

Copilot AI lite review requested due to automatic review settings September 9, 2026 02:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

Copilot AI review requested due to automatic review settings September 9, 2026 02:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new cmake --help validation should be guarded to avoid unnecessary overhead (especially in IDE/design-time scenarios), and the PR is still marked WIP with pending test coverage/validation work.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 9, 2026 02:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new generator-support validation executes cmake --help without CMakeConfigureCommandWrapper, which can validate a different CMake than the one actually used during configure and lead to incorrect pass/fail behavior.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Lite

Copilot AI changed the title [WIP] Add Visual Studio 2026 generator resolution [Microsoft.DotNet.CMake.Sdk] Resolve the Visual Studio 18 2026 CMake generator Sep 9, 2026
Copilot AI requested a review from jkoritzinsky September 9, 2026 02:33
@jkoritzinsky
jkoritzinsky marked this pull request as ready for review September 9, 2026 02:34
Copilot AI review requested due to automatic review settings September 9, 2026 02:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes align with the issue/PR goals and are covered by new targeted tests, with only a minor optional performance optimization noted.

Review details

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

src/Microsoft.DotNet.CMake.Sdk/build/Microsoft.DotNet.CMake.Sdk.targets:75

  • The cmake --help capability probe runs for every Visual Studio generator (16/17/18). Since the compatibility issue is specific to newer generators (e.g., VS 18 2026), this adds an extra process launch and captures a large help payload on common VS 16/17 builds unnecessarily.
  • Files reviewed: 5/5 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@akoeplinger
akoeplinger merged commit 3f753c4 into main Sep 9, 2026
13 checks passed
@akoeplinger
akoeplinger deleted the copilot/add-visual-studio-2026-generator-resolution branch September 9, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Microsoft.DotNet.CMake.Sdk] Add Visual Studio 2026 generator resolution

4 participants