Repository navigation
[Microsoft.DotNet.CMake.Sdk] Resolve the Visual Studio 18 2026 CMake generator - #17520
Conversation
Co-authored-by: jkoritzinsky <[email protected]>
Co-authored-by: jkoritzinsky <[email protected]>
There was a problem hiding this comment.
🟡 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
There was a problem hiding this comment.
🟡 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
Co-authored-by: jkoritzinsky <[email protected]>
There was a problem hiding this comment.
🟢 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 --helpcapability 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
ResolveVSGeneratordefaultedVSGeneratorVersionRangeto[15,18.0)and only mapped VS 16/17, so<CMakeGenerator>Visual Studio</CMakeGenerator>could never selectVisual Studio 18 2026. Consumers such asdotnet/runtimehad to duplicate the resolver and set the multi-configuration/architecture properties themselves.Changes
VSGeneratorVersionRangeis now[15,19.0)sovswherereports a VS 18 install.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 --helpis scanned for the resolved generator, and a targeted error is raised when it's missing (Visual Studio 18 2026requires CMake 4.2+) instead of a bare CMake configure failure. The check is skipped whencmakecan't be executed, so the existing failure mode surfaces instead.src/Microsoft.DotNet.CMake.Sdk.Testscovering the 16/17/18 mappings, the default version range, thex86→Win32mapping, the multi-config/architecture properties, and the new diagnostic. Follows the targets-inspection pattern inTestArchitecturesTests; picked up automatically bytests/UnitTests.proj.VSGeneratorVersionRangeis 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:
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.