skip to Main Content

I have Microsoft Visual Studio 2022 installed and when I open from IDE the menu item Help->About Microsoft Visual Studio it shows Version 17.7.7 (explicitly saying "Current" for my product) and all the related components have versions 17.*

At the same time godbolt.org suggests x64 msvc v19.37 as the latest version of the compiler and the code blow

#include <print>

int main() {
    std::print("{}", _MSC_VER);
}

being run on my version of Microsoft Visual Studio 2022 gives the same

1937

Why these versions differ and is there a way to see the msvc compiler version installed from IDE or command line?

2

Answers


  1. TL;DR: 1937 is the correct _MSC_VER for VS2022 (aka VS 17.7)


    Since the release of Visual Studio 2017, the value of the _MSC_VER is entirely unrelated to the ostensible version number (or marketing version number, or release year, or anything, really) of Visual Studio:

    https://devblogs.microsoft.com/cppblog/visual-c-compiler-version/

    Starting with VS “15” Visual Studio 2017 Preview 5 , the Visual C++ Team is monotonically updating the value of the built-in preprocessor macro _MSC_VER at every Visual C++ toolset update.

    […]

    Each major release of the Visual C++ compiler increments the hundredths-part of _MSC_VER.

    Each update within a major release increments the units-part by 1.

    For example, in VS “15” [Visual Studio 2017] Preview 5, the macro _MSC_VER evaluates to 1910. The next update [to Visual Studio 2017] will have _MSC_VER set to 1911.


    Microsoft has published a table mapping _MSC_VER values to Visual Studio releases on their Predefined Macros page.

    …which I’ve repeated here for posterity:

    Visual Studio version _MSC_VER
    Visual Studio 6.0 1200
    Visual Studio .NET 2002 (7.0) 1300
    Visual Studio .NET 2003 (7.1) 1310
    Visual Studio 2005 (8.0) 1400
    Visual Studio 2008 (9.0) 1500
    Visual Studio 2010 (10.0) 1600
    Visual Studio 2012 (11.0) 1700
    Visual Studio 2013 (12.0) 1800
    Visual Studio 2015 (14.0) 1900
    Visual Studio 2017 RTW (15.0) 1910
    Visual Studio 2017 version 15.3 1911
    Visual Studio 2017 version 15.5 1912
    Visual Studio 2017 version 15.6 1913
    Visual Studio 2017 version 15.7 1914
    Visual Studio 2017 version 15.8 1915
    Visual Studio 2017 version 15.9 1916
    Visual Studio 2019 RTW (16.0) 1920
    Visual Studio 2019 version 16.1 1921
    Visual Studio 2019 version 16.2 1922
    Visual Studio 2019 version 16.3 1923
    Visual Studio 2019 version 16.4 1924
    Visual Studio 2019 version 16.5 1925
    Visual Studio 2019 version 16.6 1926
    Visual Studio 2019 version 16.7 1927
    Visual Studio 2019 version 16.8, 16.9 1928
    Visual Studio 2019 version 16.10, 16.11 1929
    Visual Studio 2022 RTW (17.0) 1930
    Visual Studio 2022 version 17.1 1931
    Visual Studio 2022 version 17.2 1932
    Visual Studio 2022 version 17.3 1933
    Visual Studio 2022 version 17.4 1934
    Visual Studio 2022 version 17.5 1935
    Visual Studio 2022 version 17.6 1936
    Login or Signup to reply.
  2. Macro _MSC_VER translates to the version number of the compiler rather than the version of the IDE. This is explained here in learn.microsoft.com.

    One way to find the current version of Visual Studio is to execute vswhere.exe and evaluate its output.
    This tool is located in the home directory of the Visual Studio installer vs_installer ("C:Program Files (x86)Microsoft Visual StudioInstaller" on my system).

    The respective output line is something like:

    installationVersion: 17.8.34309.116
    

    From the Developer Command Prompt of Visual Studio, I get:

    ....Microsoft Visual Studio2022Community>cl /?
    Microsoft (R) C/C++ Optimizing Compiler Version 19.38.33130 for x86
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search