Tore Østergaard
Tore Østergaard

Reputation: 4602

How to get a specific Visual Studio version

As part of our TFS build I would like to gather versions of our build environment to document under what circumstances it was build. The specific Visual Studio version might not have a great impact on the build process, but it wouldn't hurt to have the right version.

In the about box I see "Version 14.0.25425.01 Update 3" but Product/File Version on devenv.exe is 14.0.25420.1. In the registry under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\14.0 there are also not much help.

The Product/File Version on C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\msenv.dll has the right version, but is this one the correct to look at?

Can I somehow programmatically get the 14.0.25425.01 that I expect?

Upvotes: 1

Views: 3771

Answers (2)

TWT
TWT

Reputation: 2591

The following code shows "16.0.29306.81 D16.2" in my VS 2019:

var shell = (package as System.IServiceProvider).GetService(typeof(Microsoft.VisualStudio.Shell.Interop.SVsShell)) as Microsoft.VisualStudio.Shell.Interop.IVsShell;
object ver = null;
shell.GetProperty((int)Microsoft.VisualStudio.Shell.Interop.__VSSPROPID5.VSSPROPID_ReleaseVersion, out ver);
System.Windows.MessageBox.Show(ver.ToString());

Upvotes: 0

asmichi
asmichi

Reputation: 26

As far as I know there is no official documentation.

From my personal research (for a similar purpose):

The version number resides in "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\ProductUpdate\SplashInfo.pkgdef". Please note that the file do not seem to exist if no update is installed.

(Additional Info: The value seems to be copied into the registry value HKCU\SOFTWARE\Microsoft\VisualStudio\14.0_Config\SplashInfo\EnvVersion at the first time you launch devenv.exe. The about box shows the value of the above registry value. By removing the registry value, you will see "14.0.25420.1 D14REL" in the about box, which seems the version of devenv.exe.

Because the registry value does not exist until you launch devenv.exe, I think SplashInfo.pkgdef is a more reliable choice.)

Upvotes: 1

Related Questions