r/cpp • MSVC STL Dev • Apr 09 '26

C++23 Support in MSVC Build Tools 14.51

https://devblogs.microsoft.com/cppblog/c23-support-in-msvc-build-tools-14-51/
180 Upvotes

67 comments sorted by

View all comments

55

u/STL MSVC STL Dev Apr 09 '26

This is the blog post about C++23 front-end features that I previously promised was coming, written by our compiler front-end dev lead Daniel Griffing with assistance from one of our FE devs RanDair Porter. The library section was written by some guy who usually makes cat noises. A few additional notes:

  • This is not the production/General Availability release of the MSVC Build Tools 14.51 (containing MSVC Compiler 19.51), but that's coming soon. I know when it's planned, but unannounced release dates are one of the few things I can't say.
  • The build tools have been significantly updated since the first Preview of 14.51, which was a snapshot from 2025-11. Right now, changes from our development main branch as of 2026-03-23 are available. This latency (of 17 days) is more than our 1-week goal, but the engineering systems team is turning the crank faster and we should be shipping new builds more regularly very soon.
  • I recently cosplayed as a VS developer and updated the Launch-VsDevShell.ps1 script to add -Preview and -NoLogo options, so if you're setting up PowerShell environments, you'll be able to select Preview build tools (and silence annoying mortals) just like the batch files have always been capable of. This change is not yet available but should be in the Insiders IDE very soon (the PowerShell script belongs to the IDE, not the build tools).
  • Our versioning story is still a dumpster fire orbiting a supernova (sorry), but the most important thing you need to be aware of is that while the VS IDE comes in Stable and Insiders versions, and both offer Latest (i.e. latest production) and Preview versions of the Build tools, Stable IDE + Preview Build Tools is OLDER than Insiders IDE + Preview Build Tools. Yes, this is confusing and makes no sense. (It's an implementation artifact of how the Stable IDE is a stabilized snapshot of Insiders at some point in time. I asked if it was by design and it was.) If you use Stable IDE + Preview Build Tools, you'll be getting a Preview, newer than Latest, but still typically quite old. If you want to see the newest compiler/library changes with that hoped-for 1-week latency between merging changes into git and landing on your SSD, you need to use Insiders IDE + Preview Build Tools. (And pass -vcvars_ver=preview to vcvarsall.bat, or equivalently configure the VS IDE.)

This is what you should observe when using the build from 2026-03-23 that contains <flat_meow> and the other goodies mentioned in this blog post (note: if you're reading this in the future, your version numbers may be higher, that's fine):

C:\Temp>"%ProgramFiles%\Microsoft Visual Studio\18\Insiders\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=preview
**********************************************************************
** Visual Studio 2026 Developer Command Prompt v18.5.0-insiders
** Copyright (c) 2026 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

C:\Temp>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.51.36223.2 for x64 (PREVIEW)
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]

5

u/donalmacc Game Developer Apr 09 '26

I have potentially a stupid question; how can I install the preview tools from the command line (for putting in a container). All the instructions assume I’m using the vs installer, and don’t list the workloads and versions to install…

7

u/STL MSVC STL Dev Apr 09 '26

Not a stupid question at all! The VS Installer can be driven from the command line in quiet mode with zero UI interaction. In the STL, see these lines of our provision-image.ps1 script for how I install the Insiders IDE (that's the /insiders/ URL) with the Preview Build Tools (that's Microsoft.VisualStudio.Component.VC.Preview.Tools.x86.x64).

To figure out which workload names you want, you can take a normal VS installation that's been set up how you want, and click More > Export Configuration in the VS Installer. That will write a .vsconfig file anywhere you like (without modifying that installation), which you can then inspect for the workload names that correspond to what you've selected in the installer.

For more info, see the Use command-line parameters to install, update, and manage Visual Studio documentation, which explains what the various options do, and also provides the URLs for the Stable IDE.

Note: It is not possible to get an unchanging URL to a specific version of the Insiders IDE, or to select arbitrary historical versions of the Preview Build Tools (unlike the Stable IDE / production Build Tools where you can pin specific versions). If you go the Insiders IDE + Preview Build Tools path, you're going to capture the newest bits, as I do in the STL whenever we update our toolset for PR/CI checks. (This is baked into our VM images so they don't change out from underneath us; if we installed the tools for every run, it would be both slower and volatile.)

3

u/donalmacc Game Developer Apr 09 '26

So I’ve been using the vs installer from the CLI for a long time, but TIL you can export the workloads from the installer! Getting the versions in the workloads is an exercise il need to figure out hit at the very least your setup script will give me a one liner for installing. Thanks :)

2

u/monamimani Apr 09 '26

I do wish github would provide an image with the insider and now preview version of the build tools. I thought that with the new Preview msvc in the Stable it would be easier to convince them to just add 1 workload. But from what you are saying that will not be the same as in the Insider channel...

So even with hopefully weekly updates it would still take months for fixes and new development to go Insider(msvc Preview) -> Stable(msvc Stable). Hopefully they don't do Insider(msvc Preview) -> Insider(msvc Stable) -> Stable(msvc Preview) -> Stable(msvc Stable).

3

u/STL MSVC STL Dev Apr 09 '26

I can't comment on GitHub actions runner images.

The Latest (production) Build Tools, as available in both the Stable IDE and Insiders IDE, will be updated on our 6-month release frequency as previously announced, with every 2 years being a Long-Term Support release. The Preview Build Tools in the Insiders IDE are "fresh from the oven" (i.e. MSVC main development) with hopefully 1 week latency. What's happening with the Preview Build Tools in the Stable IDE is that they will be a snapshot of the Preview Build Tools in the Insiders IDE at the time that it branched for stabilization. I think this might mean that Stable IDE + Preview Build Tools might be a month or so old at worst, but no promises. As I mentioned, if you're focused on the build tools, you want Insiders IDE to get them.

2

u/monamimani Apr 09 '26

BTW I liked how you "patched" Launch-VsDevShell.ps1 in that provision-image.ps1!

3

u/STL MSVC STL Dev Apr 09 '26

Thanks! It's nice to know my little tricks are appreciated. 😸🩹

2

u/starfreakclone MSVC FE Dev Apr 10 '26

If all you need are the build tools you can also try Martins' python script which I've had success with on personal projects.

1

u/donalmacc Game Developer Apr 10 '26

This is perfect! In a perfect world I’d have no python dependency but this will do very nicely.

4

u/domiran game engine dev Apr 09 '26

Thanks, this info really is the flat's meow! (Sorry. I thought it was funny.)

2

u/tartaruga232 MSVC user, r/cpp_modules Apr 09 '26

I'm confused.

I have no idea how and when I got it (magic?), but I now seem to have

Microsoft (R) C/C++ Optimizing Compiler Version 19.51.36223.2 for x64 (PREVIEW)

as well.

I see that in the build output window in Visual Studio, because I switched off the compiler startup banner suppression for one of the cpp files in the project setting.

After reading your announcement I started the Visual Studio Installer, but there was nothing new to update.

How did I manage to get this new compiler?

I'm using Visual Studio Insiders and followed the instructions to have the latest MSVC build tools preview. Here is what I did.

3

u/STL MSVC STL Dev Apr 09 '26

If you've installed the Insiders IDE with the Preview Build Tools, then whenever the IDE wants to update itself, it will also update the build tools when a new release is available. The build tools are just a component as far as the installer is concerned, to be updated like everything else. (I run the VS Installer rather frequently to check for new updates and I rarely run the IDE directly, but as I recall if you're the kind of person who only runs the IDE, then it likes to perform an auto-update at the time of shutdown, although my memory may be faulty.)

1

u/tartaruga232 MSVC user, r/cpp_modules Apr 09 '26

Thanks. I think VS told me there is an update for VS some days ago. I clicked on the link with the release notes and found nothing interesting mentioned there. But I always let it do the update when there is one.

So I got an update of the "MSVC Build Tools" without noticing it...

Where can I see the exact version number of the "MSVC Build Tools" I have?

So far, I only found out the version of the compiler (19.51.36223.2). How does that relate to the version of the "MSVC Build Tools"?

3

u/STL MSVC STL Dev Apr 10 '26

The build tools (libraries, linker, etc.) and compiler versions are offset in their major version component. The 14.51 build tools have the 19.51 compiler. (This is because the C++ compiler predates the "Visual" in "Visual C++". Like I said, dumpster fire orbiting a supernova.) Very occasionally the following components will vary slightly, if parts of the toolset were rebuilt at different times, but generally they march in lockstep and super-minor variations can be ignored.

2

u/tartaruga232 MSVC user, r/cpp_modules Apr 10 '26

Thanks a lot for shedding light on this. I thought there would be detailed version numbers for an aggregate component called "build tools" too. Perhaps when Microsoft talks about "Build Tools" only two numbers are used (XX.YY) for the version. So I can't really get an update of the "build tools", that's just a family of individual tools with a detailed version for each tool, like compiler, linker, etc. These are updated individually. The "Build Tools" version for the versions 19.51.MMMM.NNNN of the compiler is just 14.51 and stays the same when minor version numbers of the compiler are counted up. Ist this correct?

3

u/STL MSVC STL Dev Apr 10 '26

No. The build tools have a full, detailed version of 14.minor.build.patch, and that version appears on everything (linker, library DLLs, etc.) with the exception of the compiler, which is 19.minor.build.patch, and they stay in sync (or nearly so):

  C:\Temp>cl
  Microsoft (R) C/C++ Optimizing Compiler Version 19.51.36223.2 for x64 (PREVIEW)
  [...]

  C:\Temp>link
  Microsoft (R) Incremental Linker Version 14.51.36223.2 (PREVIEW)
  [...]

The compiler version is the one that appears in _MSC_VER and _MSC_FULL_VER.

2

u/tartaruga232 MSVC user, r/cpp_modules Apr 10 '26

Thanks a lot!

1

u/rodrigocfd WinLamb Apr 10 '26

Will VS2022 receive this update?

4

u/STL MSVC STL Dev Apr 10 '26

Never. VS 2022 is done, except for critical codegen bugfixes and security updates.

1

u/AmigaDev Oct 31 '26

In VS 2022, in the C++ Language Standard property, I see the C++23 option "Preview - ISO C++23 Standard (/std:c++23preview)". Does your comment above mean that we will never see a stable production-ready ("non-preview") support of C++23 in VS 2022? I recall with VS 2019 it started with C++20 preview, and then the preview status was removed, and we could enjoy production-ready C++20 in VS 2019. (I'm particularly interested in using C++23std::expected with VS 2022.) Thanks.

1

u/STL MSVC STL Dev Oct 31 '26

Does your comment above mean that we will never see a stable production-ready ("non-preview") support of C++23 in VS 2022?

Never.

1

u/AmigaDev Nov 01 '26

Thanks for the clarification. One of the problems with VS 2026 vs. VS 2022 is that, according to the table here:

https://learn.microsoft.com/en-us/visualstudio/releases/2026/servicing-vs

VS 2022 has an End of Support in 2032 (great), but VS 2026 only in 2028! :-(

Given that, I wonder if, for the sole purpose of using std::expected in C++20 codebases, I can take your top quality C++23 <expected> implementation from the GitHub Microsoft STL repo, modify it, and make it compilable in C++20 mode (and putting that in my custom namespace instead of polluting std::), and use it in both commercial closed-source and free open-source code, all written in C++20 and built with VS 2022. I think the license adopted by the Microsoft STL on GitHub should allow that. Thanks.

2

u/STL MSVC STL Dev Nov 01 '26

VS 2022 has an End of Support in 2032 (great), but VS 2026 only in 2028! :-(

Yes, that's intentional. Long support timelines may seem great to you, but they're burdensome to implementers, which directly comes at the expense of fixing bugs and implementing features in future versions. It was getting to be enough of a problem for VS and MSVC that we made this major change (having the ultrabosses change something that affects enterprise support shows that it was a very big deal indeed).

I think the license adopted by the Microsoft STL on GitHub should allow that.

I am not a lawyer, and I don't speak for Microsoft, but that would be perfectly fine with me, and I wouldn't expect that anyone would have a problem with it, as long you respect the license terms (primarily preserving source attribution).

1

u/AmigaDev Nov 02 '26 edited Nov 02 '26

Thanks for all the clarifications. I would preserve source attribution even if that was not explicitly required in the license, for professionalism and ethics.

Regarding long term support of software, at least in EU, there are industrial devices still running Windows 7 (and I would not exclude that some even run XP). But I see your point of having to prioritize limited resources.

→ More replies (1)