Skip to content

Document Visual Studio 2022 and 2026 Windows builds#1458

Open
bmehta001 wants to merge 14 commits into
microsoft:mainfrom
bmehta001:bhamehta/windows-build-docs
Open

Document Visual Studio 2022 and 2026 Windows builds#1458
bmehta001 wants to merge 14 commits into
microsoft:mainfrom
bmehta001:bhamehta/windows-build-docs

Conversation

@bmehta001

@bmehta001 bmehta001 commented May 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Addresses the VS2022/VS2026 Windows build documentation gap from #1260 and keeps related Windows build-script fixes in one focused PR.

  • Document the VS2019/VS2022/VS2026 command-line build wrappers.
  • Add build-all-v145.bat for VS2026/v145 and teach vcvars.cmd to find VS2026 installs.
  • Make VS2022/VS2026 wrappers skip legacy .NET Framework 4.0 targets that modern Visual Studio may report as unsupported.
  • Normalize solution-level :Build targets in tools/RunMsBuild.bat so project builds work consistently.
  • Fix setup-buildtools.cmd to use the existing .vsconfig.vs* naming scheme and add VS2022/VS2026 configs.

Validation

  • git diff --check
  • tools\RunMsBuild.bat x64 Release sqlite:Build with VS2026/v145
  • tools\RunMsBuild.bat x64 Release "sqlite:Build,zlib:Rebuild" with VS2026/v145
  • Verified VS2026 detection finds the local VS 18 Enterprise install and matching .vsconfig.vs2026.

Fixes #1260

Notes:

Clarify the VS2019/VS2022/VS2026 command-line build entry points, avoid legacy .NET Framework 4.0 projects in VS2022+ wrappers, and make solution-level :Build targets work through RunMsBuild.

Files changed:
- docs/cpp-start-windows.md
- build-all.bat
- build-all-v143.bat
- build-all-v145.bat
- tools/RunMsBuild.bat
- tools/setup-buildtools.cmd
- tools/vcvars.cmd
- tools/.vsconfig.vs2022
- tools/.vsconfig.vs2026
- Solutions/before.targets

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bmehta001 bmehta001 requested a review from a team as a code owner May 30, 2026 18:13
@bmehta001 bmehta001 changed the title Document Windows build toolsets and legacy targets Document Visual Studio 2022 and 2026 Windows builds May 30, 2026
@bmehta001 bmehta001 requested a review from Copilot June 1, 2026 22:04
@bmehta001 bmehta001 self-assigned this Jun 1, 2026

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.

Pull request overview

Adds Windows build documentation and tooling support for Visual Studio 2022 and the upcoming VS2026 (v145), plus a couple of related build-script fixes that unblock VS2022/VS2026 command-line builds.

Changes:

  • Document VS2019/VS2022/VS2026 build wrappers and add build-all-v145.bat; teach vcvars.cmd to detect VS2022 Professional and VS2026 (including the Microsoft Visual Studio\18\* install path).
  • Skip legacy .NET Framework 4.0 targets (net40, SampleCsNet40) on VS2022/VS2026 via SKIP_NET40_BUILD, and add a v145/VS2026 mapping in Solutions/before.targets.
  • In RunMsBuild.bat, normalize solution-level :Build targets (strip the :Build suffix) and fix the if ("%~4" == "") syntax; in setup-buildtools.cmd, use the existing .vsconfig.vs%VSVERSION% naming and add .vsconfig.vs2022 / .vsconfig.vs2026.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tools/vcvars.cmd Detects VS2022 Professional, VS2022 BuildTools, and VS2026 (incl. \18\ install paths).
tools/setup-buildtools.cmd Uses .vsconfig.vs%VSVERSION% matching the actual file naming scheme.
tools/RunMsBuild.bat Normalizes name:Build targets to name; fixes if syntax; propagates exit code.
tools/.vsconfig.vs2022 New VS2022 component manifest.
tools/.vsconfig.vs2026 New VS2026 component manifest.
Solutions/before.targets Maps VisualStudioVersion=18.0 to PlatformToolset=v145.
docs/cpp-start-windows.md Documents the per-toolset build-all wrappers and the .NET 4.0 caveat.
build-all.bat Conditionally includes net40 and SampleCsNet40 based on SKIP_NET40_BUILD.
build-all-v143.bat Sets SKIP_NET40_BUILD=1 for VS2022.
build-all-v145.bat New VS2026/v145 wrapper that skips .NET 4.0 targets.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bmehta001 bmehta001 requested a review from pablo-msft June 1, 2026 22:09
Comment thread build-all.bat Outdated
Comment thread tools/.vsconfig.vs2022
bmehta001 and others added 5 commits June 3, 2026 04:34
Clarify the Windows Visual Studio build entry point by moving the build matrix implementation to build-all-windows.bat while keeping build-all.bat as a compatibility wrapper. Update version-specific wrappers, CI, helper scripts, and docs to call the clearer name.

Also clarify that MFC/ATL Visual Studio components remain intentional because SampleCppMini uses static MFC.

Validation:
- git diff --check
- build-all-v142.bat Solutions\build.compact-dll.props smoke with all build legs skipped confirmed custom props forwarding
- material self-review found no remaining issues

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolve the Solutions/before.targets conflict in favor of main's cascading
VersionGreaterThanOrEquals PlatformToolset mapping: it already maps VS2026
(18.0) to v145 -- this PR's goal -- and future-proofs newer VS versions,
superseding this branch's exact-equality mapping. The shared v141 fallback is
unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Addresses code-review findings on the new Windows build CI:
- build-windows-vs2022.yaml ran build-all-windows.bat with v143/vs2022 but
  without SKIP_NET40_BUILD, so it tried to build the legacy net40 /
  SampleCsNet40 projects that VS2022 cannot build (and that the docs say are
  skipped). Add SKIP_NET40_BUILD: 1 to match the canonical build-all-v143.bat.
- build-all-windows.bat called tools\RunMsBuild.bat ~12 times with no errorlevel
  check between them, so only the last build's exit code reached the caller; an
  intermediate config failure was swallowed and the gating CI job could report
  success on a broken build. Add 'if errorlevel 1 exit /b 1' after each call to
  fail fast. (Pre-existing in build-all.bat, but newly load-bearing now that a CI
  gate runs this script; verified the swallowing and the fix with an isolated
  batch repro.)
- Remove continue-on-error: true from the Checkout step so a failed checkout
  fails the job.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…vsconfig

The vs2022/vs2026 component configs only listed the bare
Microsoft.VisualStudio.Component.Windows10SDK; since setup-buildtools.cmd
applies them with --quiet and no --includeRecommended, a fresh install could
end up with no concrete Windows SDK and fail to build. Add the explicit
Windows11SDK.22621 component (the 10.0.22621 platform SDK the repo's CodeQL
workflow already pins via WindowsSDKVersion: 10.0.22621.0), mirroring how
.vsconfig.vs2019 pairs the bare component with a concrete Windows10SDK.18362.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Comment thread docs/cpp-start-windows.md Outdated
Comment thread build-all-windows.bat Outdated
…dows.bat

- docs/cpp-start-windows.md: drop 'win32-cs' from the list of legacy .NET 4.0
  projects the VS2022/2026 wrappers skip. MSTelemetrySDK.sln only contains net40
  and SampleCsNet40 (gated by SKIP_NET40_BUILD); win32-cs lives in a separate
  Solutions/win32-cs solution and is not part of the SDK build matrix.
- build-all-windows.bat: use 'cd /d "%~dp0"' so the script reliably changes drive
  and tolerates spaces when invoked from another drive/working directory.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Comment thread build-all-v142.bat Outdated
Comment thread build-all-v143.bat Outdated
Comment thread build-all-v145.bat Outdated
Comment thread tools/build-Win10-compact-exp.cmd Outdated
The VS-version wrappers (build-all-v142/v143/v145.bat) called
build-all-windows.bat by bare relative name, and tools\build-Win10-compact-exp.cmd
used 'cd ..' + a CWD-relative call. Invoked from another drive/working directory
(e.g. via an absolute path), the sibling script wouldn't be found. Call it via a
%~dp0-relative absolute path instead so the wrappers work from any CWD:
- build-all-v142/v143/v145.bat: call "%~dp0build-all-windows.bat" %*
- build-Win10-compact-exp.cmd: drop the fragile 'cd ..'/%CD% and call
  "%~dp0..\build-all-windows.bat" with the props file as a %~dp0-relative path.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.

bmehta001 and others added 2 commits June 10, 2026 01:45
vcvars.cmd sets VSTOOLS_NOTFOUND and exits 0 when it can't find any Visual
Studio install, but RunMsBuild.bat didn't check it and went straight to
msbuild, so a developer with no/undetected VS only saw a cryptic
"'msbuild' is not recognized". Check VSTOOLS_NOTFOUND after calling vcvars and
print an actionable error (install VS with the C++ workload, or run
setup-buildtools.cmd, or set VSTOOLS_VERSION) before aborting.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
vcvars.cmd's label cascade silently moves forward when the requested Visual
Studio isn't installed (e.g. a vs2022 request ends up on vs2026). Combined with
the version wrappers pinning PlatformToolset (v143/v145), that mismatch surfaces
later as a confusing toolset error from msbuild. Capture the explicitly
requested version and, once configuration succeeds, print a clear warning when
the detected VS differs from what was asked for. The configured path now returns
a deterministic exit 0 (callers key off VSTOOLS_NOTFOUND, not the exit code).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Comment thread tools/RunMsBuild.bat
Copilot round: vcvars.cmd set VSTOOLS_NOTFOUND=1 on the not-found path but
never cleared it on success, so a stale value left in the shell by a previous
failed run could make RunMsBuild.bat's new guard abort a build even when VS is
present. Clear VSTOOLS_NOTFOUND at vcvars.cmd entry (only the not-found path
sets it now) and check the explicit ==1 value in RunMsBuild.bat instead of mere
existence. Verified at tools/vcvars.cmd entry and tools/RunMsBuild.bat:17.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Comment thread tools/vcvars.cmd
Copilot round: clearing only VSTOOLS_NOTFOUND wasn't enough. Callers such as
tools\setup-buildtools.cmd gate on if exist "%VSINSTALLDIR%" and use
%VSVERSION% for the .vsconfig path, so a stale VSINSTALLDIR/VSVERSION/VSDEVCMD
left in the shell (or caller environment) could make them act on the wrong
install after a failed detection. Reset VSINSTALLDIR, VSDEVCMD and VSVERSION
alongside VSTOOLS_NOTFOUND at entry so each run starts from a fully clean
detection state; only the matching detection path repopulates them.

Verified: stale VSINSTALLDIR is replaced with the real path on success and left
empty when detection doesn't match (tools/setup-buildtools.cmd:42,44).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.

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.

VS2022 support

3 participants