I could read registry HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0
.
However, it doesn\'t give me any information about the edition of it - Profes
An updated answer to this question would be the following :
"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property productId
Resolves to 2019
"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property catalog_productLineVersion
Resolves to Microsoft.VisualStudio.Product.Professional
For anyone stumbling on this question, here is the answer if you are doing C++: You can check in your cpp code for vs version like the example bellow which links against a library based on vs version being 2015 or higher:
#if (_MSC_VER > 1800)
#pragma comment (lib, "legacy_stdio_definitions.lib")
#endif
This is done at link time and no extra run-time cost.
Put this code somewhere in your C++ project:
#ifdef _DEBUG
TCHAR version[50];
sprintf(&version[0], "Version = %d", _MSC_VER);
MessageBox(NULL, (LPCTSTR)szMsg, "Visual Studio", MB_OK | MB_ICONINFORMATION);
#endif
Note that _MSC_VER
symbol is Microsoft specific. Here you can find a list of Visual Studio versions with the value for _MSC_VER
for each version.
All the information in this thread is now out of date with the recent release of vswhere. Download that and use it.
Its not very subtle, but there is a folder in the install location that carries the installed version name.
eg I've got:
C:\Program Files\Microsoft Visual Studio 9.0\Microsoft Visual Studio 2008 Standard Edition - ENU
and
C:\Program Files\Microsoft Visual Studio 10.0\Microsoft Visual Studio 2010 Professional - ENU
You could find the install location from the registry keys you listed above.
Alternatively this will be in the registry at a number of places, eg:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Setup\Microsoft Visual Studio 2008 Standard Edition - ENU
There are loads of values and keys with the string in, you can find them by looking for "Microsoft Visual Studio 2010" in the Regedit>Edit>Find function.
You'd just need to pick the one you want and do a little bit of string matching.
In Visual Studio, the Tab 'Help'-> 'About Microsoft Visual Studio' should give you the desired infos.